<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-- (c) The University of Glasgow 2006</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-4"></span><span class="hs-pragma">{-# LANGUAGE KindSignatures #-}</span><span>
</span><span id="line-5"></span><span class="hs-pragma">{-# LANGUAGE ConstraintKinds #-}</span><span>
</span><span id="line-6"></span><span class="hs-pragma">{-# LANGUAGE BangPatterns #-}</span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# LANGUAGE TupleSections #-}</span><span>
</span><span id="line-8"></span><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
</span><span id="line-9"></span><span>
</span><span id="line-10"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}</span><span>
</span><span id="line-11"></span><span>
</span><span id="line-12"></span><span class="hs-comment">-- | Highly random utility functions</span><span>
</span><span id="line-13"></span><span class="hs-comment">--</span><span>
</span><span id="line-14"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Utils.Misc</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-15"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Flags dependent on the compiler build</span></span><span>
</span><span id="line-16"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#ghciSupported"><span class="hs-identifier">ghciSupported</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#debugIsOn"><span class="hs-identifier">debugIsOn</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-17"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#isWindowsHost"><span class="hs-identifier">isWindowsHost</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#isDarwinHost"><span class="hs-identifier">isDarwinHost</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-18"></span><span>
</span><span id="line-19"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Miscellaneous higher-order functions</span></span><span>
</span><span id="line-20"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#applyWhen"><span class="hs-identifier">applyWhen</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#nTimes"><span class="hs-identifier">nTimes</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-21"></span><span>
</span><span id="line-22"></span><span>        </span><span class="annot"><span class="hs-comment">-- * General list processing</span></span><span>
</span><span id="line-23"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#zipEqual"><span class="hs-identifier">zipEqual</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#zipWithEqual"><span class="hs-identifier">zipWithEqual</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#zipWith3Equal"><span class="hs-identifier">zipWith3Equal</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#zipWith4Equal"><span class="hs-identifier">zipWith4Equal</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#zipLazy"><span class="hs-identifier">zipLazy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#stretchZipWith"><span class="hs-identifier">stretchZipWith</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#zipWithAndUnzip"><span class="hs-identifier">zipWithAndUnzip</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#zipAndUnzip"><span class="hs-identifier">zipAndUnzip</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>
</span><span id="line-26"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#zipWithLazy"><span class="hs-identifier">zipWithLazy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#zipWith3Lazy"><span class="hs-identifier">zipWith3Lazy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#filterByList"><span class="hs-identifier">filterByList</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#filterByLists"><span class="hs-identifier">filterByLists</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#partitionByList"><span class="hs-identifier">partitionByList</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-29"></span><span>
</span><span id="line-30"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#unzipWith"><span class="hs-identifier">unzipWith</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#mapFst"><span class="hs-identifier">mapFst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#mapSnd"><span class="hs-identifier">mapSnd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#chkAppend"><span class="hs-identifier">chkAppend</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#mapAndUnzip"><span class="hs-identifier">mapAndUnzip</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#mapAndUnzip3"><span class="hs-identifier">mapAndUnzip3</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-34"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#filterOut"><span class="hs-identifier">filterOut</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#partitionWith"><span class="hs-identifier">partitionWith</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#dropWhileEndLE"><span class="hs-identifier">dropWhileEndLE</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#spanEnd"><span class="hs-identifier">spanEnd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#last2"><span class="hs-identifier">last2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#lastMaybe"><span class="hs-identifier">lastMaybe</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-37"></span><span>
</span><span id="line-38"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.List.html#foldl1%27"><span class="hs-identifier">foldl1'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#foldl2"><span class="hs-identifier">foldl2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#count"><span class="hs-identifier">count</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#countWhile"><span class="hs-identifier">countWhile</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#all2"><span class="hs-identifier">all2</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-39"></span><span>
</span><span id="line-40"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#lengthExceeds"><span class="hs-identifier">lengthExceeds</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#lengthIs"><span class="hs-identifier">lengthIs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#lengthIsNot"><span class="hs-identifier">lengthIsNot</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-41"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#lengthAtLeast"><span class="hs-identifier">lengthAtLeast</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#lengthAtMost"><span class="hs-identifier">lengthAtMost</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#lengthLessThan"><span class="hs-identifier">lengthLessThan</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-42"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#listLengthCmp"><span class="hs-identifier">listLengthCmp</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#atLength"><span class="hs-identifier">atLength</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-43"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#equalLength"><span class="hs-identifier">equalLength</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#compareLength"><span class="hs-identifier">compareLength</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#leLength"><span class="hs-identifier">leLength</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#ltLength"><span class="hs-identifier">ltLength</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-44"></span><span>
</span><span id="line-45"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#isSingleton"><span class="hs-identifier">isSingleton</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#only"><span class="hs-identifier">only</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#singleton"><span class="hs-identifier">GHC.Utils.Misc.singleton</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-46"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#notNull"><span class="hs-identifier">notNull</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#snocView"><span class="hs-identifier">snocView</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-47"></span><span>
</span><span id="line-48"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#isIn"><span class="hs-identifier">isIn</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#isn%27tIn"><span class="hs-identifier">isn'tIn</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-49"></span><span>
</span><span id="line-50"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#chunkList"><span class="hs-identifier">chunkList</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-51"></span><span>
</span><span id="line-52"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#changeLast"><span class="hs-identifier">changeLast</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-53"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#mapLastM"><span class="hs-identifier">mapLastM</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-54"></span><span>
</span><span id="line-55"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#whenNonEmpty"><span class="hs-identifier">whenNonEmpty</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#mergeListsBy"><span class="hs-identifier">mergeListsBy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-58"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#isSortedBy"><span class="hs-identifier">isSortedBy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-59"></span><span>
</span><span id="line-60"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Tuples</span></span><span>
</span><span id="line-61"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#fstOf3"><span class="hs-identifier">fstOf3</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#sndOf3"><span class="hs-identifier">sndOf3</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#thdOf3"><span class="hs-identifier">thdOf3</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-62"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#firstM"><span class="hs-identifier">firstM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#first3M"><span class="hs-identifier">first3M</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#secondM"><span class="hs-identifier">secondM</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-63"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#fst3"><span class="hs-identifier">fst3</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#snd3"><span class="hs-identifier">snd3</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#third3"><span class="hs-identifier">third3</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-64"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#uncurry3"><span class="hs-identifier">uncurry3</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-65"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#liftFst"><span class="hs-identifier">liftFst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#liftSnd"><span class="hs-identifier">liftSnd</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-66"></span><span>
</span><span id="line-67"></span><span>        </span><span class="annot"><span class="hs-comment">-- * List operations controlled by another list</span></span><span>
</span><span id="line-68"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#takeList"><span class="hs-identifier">takeList</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#dropList"><span class="hs-identifier">dropList</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#splitAtList"><span class="hs-identifier">splitAtList</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#split"><span class="hs-identifier">split</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-69"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#dropTail"><span class="hs-identifier">dropTail</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#capitalise"><span class="hs-identifier">capitalise</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-70"></span><span>
</span><span id="line-71"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Sorting</span></span><span>
</span><span id="line-72"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Exts.html#sortWith"><span class="hs-identifier">sortWith</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#minWith"><span class="hs-identifier">minWith</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#nubSort"><span class="hs-identifier">nubSort</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#ordNub"><span class="hs-identifier">ordNub</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-73"></span><span>
</span><span id="line-74"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Comparisons</span></span><span>
</span><span id="line-75"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#isEqual"><span class="hs-identifier">isEqual</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#eqListBy"><span class="hs-identifier">eqListBy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#eqMaybeBy"><span class="hs-identifier">eqMaybeBy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-76"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#thenCmp"><span class="hs-identifier">thenCmp</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#cmpList"><span class="hs-identifier">cmpList</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-77"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#removeSpaces"><span class="hs-identifier">removeSpaces</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-78"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#%3C%26%26%3E"><span class="hs-operator">(&lt;&amp;&amp;&gt;)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#%3C%7C%7C%3E"><span class="hs-operator">(&lt;||&gt;)</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-79"></span><span>
</span><span id="line-80"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Edit distance</span></span><span>
</span><span id="line-81"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#fuzzyMatch"><span class="hs-identifier">fuzzyMatch</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#fuzzyLookup"><span class="hs-identifier">fuzzyLookup</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-82"></span><span>
</span><span id="line-83"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Transitive closures</span></span><span>
</span><span id="line-84"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#transitiveClosure"><span class="hs-identifier">transitiveClosure</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Strictness</span></span><span>
</span><span id="line-87"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#seqList"><span class="hs-identifier">seqList</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#strictMap"><span class="hs-identifier">strictMap</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-88"></span><span>
</span><span id="line-89"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Module names</span></span><span>
</span><span id="line-90"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#looksLikeModuleName"><span class="hs-identifier">looksLikeModuleName</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-91"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#looksLikePackageName"><span class="hs-identifier">looksLikePackageName</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-92"></span><span>
</span><span id="line-93"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Argument processing</span></span><span>
</span><span id="line-94"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#getCmd"><span class="hs-identifier">getCmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#toCmdArgs"><span class="hs-identifier">toCmdArgs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#toArgs"><span class="hs-identifier">toArgs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-95"></span><span>
</span><span id="line-96"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Integers</span></span><span>
</span><span id="line-97"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#exactLog2"><span class="hs-identifier">exactLog2</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Floating point</span></span><span>
</span><span id="line-100"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#readRational"><span class="hs-identifier">readRational</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-101"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#readHexRational"><span class="hs-identifier">readHexRational</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-102"></span><span>
</span><span id="line-103"></span><span>        </span><span class="annot"><span class="hs-comment">-- * IO-ish utilities</span></span><span>
</span><span id="line-104"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#doesDirNameExist"><span class="hs-identifier">doesDirNameExist</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-105"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#getModificationUTCTime"><span class="hs-identifier">getModificationUTCTime</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-106"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#modificationTimeIfExists"><span class="hs-identifier">modificationTimeIfExists</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-107"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#withAtomicRename"><span class="hs-identifier">withAtomicRename</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-108"></span><span>
</span><span id="line-109"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#global"><span class="hs-identifier">global</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#consIORef"><span class="hs-identifier">consIORef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#globalM"><span class="hs-identifier">globalM</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-110"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#sharedGlobal"><span class="hs-identifier">sharedGlobal</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#sharedGlobalM"><span class="hs-identifier">sharedGlobalM</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-111"></span><span>
</span><span id="line-112"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Filenames and paths</span></span><span>
</span><span id="line-113"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#Suffix"><span class="hs-identifier">Suffix</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-114"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#splitLongestPrefix"><span class="hs-identifier">splitLongestPrefix</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-115"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#escapeSpaces"><span class="hs-identifier">escapeSpaces</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-116"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#Direction"><span class="hs-identifier">Direction</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#reslash"><span class="hs-identifier">reslash</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-117"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#makeRelativeTo"><span class="hs-identifier">makeRelativeTo</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-118"></span><span>
</span><span id="line-119"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Utils for defining Data instances</span></span><span>
</span><span id="line-120"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#abstractConstr"><span class="hs-identifier">abstractConstr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#abstractDataType"><span class="hs-identifier">abstractDataType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#mkNoRepType"><span class="hs-identifier">mkNoRepType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-121"></span><span>
</span><span id="line-122"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Utils for printing C code</span></span><span>
</span><span id="line-123"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#charToC"><span class="hs-identifier">charToC</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-124"></span><span>
</span><span id="line-125"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Hashing</span></span><span>
</span><span id="line-126"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#hashString"><span class="hs-identifier">hashString</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Call stacks</span></span><span>
</span><span id="line-129"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Stack.Types.html#HasCallStack"><span class="hs-identifier">HasCallStack</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-130"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#HasDebugCallStack"><span class="hs-identifier">HasDebugCallStack</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-131"></span><span>
</span><span id="line-132"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Utils for flags</span></span><span>
</span><span id="line-133"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#OverridingBool"><span class="hs-identifier">OverridingBool</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-134"></span><span>        </span><span class="annot"><a href="GHC.Utils.Misc.html#overrideWith"><span class="hs-identifier">overrideWith</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-135"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-139"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-140"></span><span>
</span><span id="line-141"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Exception.html"><span class="hs-identifier">GHC.Utils.Exception</span></a></span><span>
</span><span id="line-142"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html"><span class="hs-identifier">GHC.Utils.Panic.Plain</span></a></span><span>
</span><span id="line-143"></span><span>
</span><span id="line-144"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#"><span class="hs-identifier">Data.Data</span></a></span><span>
</span><span id="line-145"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.IORef.html#"><span class="hs-identifier">Data.IORef</span></a></span><span>       </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier">IORef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#newIORef"><span class="hs-identifier">newIORef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#atomicModifyIORef%27"><span class="hs-identifier">atomicModifyIORef'</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-146"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.Unsafe.html#"><span class="hs-identifier">System.IO.Unsafe</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Unsafe.html#unsafePerformIO"><span class="hs-identifier">unsafePerformIO</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-147"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span>        </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.OldList.html#group"><span class="hs-identifier">group</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-148"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.NonEmpty.html#"><span class="hs-identifier">Data.List.NonEmpty</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#NonEmpty"><span class="hs-identifier">NonEmpty</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-149"></span><span>
</span><span id="line-150"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.Exts.html#"><span class="hs-identifier">GHC.Exts</span></a></span><span>
</span><span id="line-151"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.Stack.html#"><span class="hs-identifier">GHC.Stack</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Stack.Types.html#HasCallStack"><span class="hs-identifier">HasCallStack</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-152"></span><span>
</span><span id="line-153"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Applicative.html#"><span class="hs-identifier">Control.Applicative</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#liftA2"><span class="hs-identifier">liftA2</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-154"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier">liftM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#guard"><span class="hs-identifier">guard</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-155"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#"><span class="hs-identifier">Control.Monad.IO.Class</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#MonadIO"><span class="hs-identifier">MonadIO</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier">liftIO</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-156"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.Conc.Sync.html#"><span class="hs-identifier">GHC.Conc.Sync</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Conc.Sync.html#sharedCAF"><span class="hs-identifier">sharedCAF</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-157"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.Error.html#"><span class="hs-identifier">System.IO.Error</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">IO</span></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/System.IO.Error.html#isDoesNotExistError"><span class="hs-identifier">isDoesNotExistError</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-158"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../directory/src/System.Directory.html#"><span class="hs-identifier">System.Directory</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../directory/src/System.Directory.html#doesDirectoryExist"><span class="hs-identifier">doesDirectoryExist</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../directory/src/System.Directory.html#getModificationTime"><span class="hs-identifier">getModificationTime</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../directory/src/System.Directory.html#renameFile"><span class="hs-identifier">renameFile</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-159"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.html#"><span class="hs-identifier">System.FilePath</span></a></span><span>
</span><span id="line-160"></span><span>
</span><span id="line-161"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Char.html#"><span class="hs-identifier">Data.Char</span></a></span><span>        </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Unicode.html#isUpper"><span class="hs-identifier">isUpper</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Unicode.html#isAlphaNum"><span class="hs-identifier">isAlphaNum</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier">isSpace</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Char.html#chr"><span class="hs-identifier">chr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#ord"><span class="hs-identifier">ord</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Unicode.html#isDigit"><span class="hs-identifier">isDigit</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Unicode.html#toUpper"><span class="hs-identifier">toUpper</span></a></span><span>
</span><span id="line-162"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Unicode.html#isHexDigit"><span class="hs-identifier">isHexDigit</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Char.html#digitToInt"><span class="hs-identifier">digitToInt</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-163"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Int.html#"><span class="hs-identifier">Data.Int</span></a></span><span>
</span><span id="line-164"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Ratio.html#"><span class="hs-identifier">Data.Ratio</span></a></span><span>       </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Real.html#%25"><span class="hs-operator">(%)</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-165"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Ord.html#"><span class="hs-identifier">Data.Ord</span></a></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.Ord.html#comparing"><span class="hs-identifier">comparing</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-166"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Bits.html#"><span class="hs-identifier">Data.Bits</span></a></span><span>
</span><span id="line-167"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Word.html#"><span class="hs-identifier">Data.Word</span></a></span><span>
</span><span id="line-168"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../containers/src/Data.IntMap.html#"><span class="hs-identifier">Data.IntMap</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">IM</span></span><span>
</span><span id="line-169"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../containers/src/Data.Set.html#"><span class="hs-identifier">Data.Set</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Set</span></span><span>
</span><span id="line-170"></span><span>
</span><span id="line-171"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../time/src/Data.Time.html#"><span class="hs-identifier">Data.Time</span></a></span><span class="hs-cpp">

#if defined(DEBUG)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-identifier">GHC.Utils.Outputable</span><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">warnPprTrace</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">text</span><span> </span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-177"></span><span class="hs-keyword">infixr</span><span> </span><span class="hs-number">9</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#thenCmp"><span class="hs-operator hs-type">`thenCmp`</span></a></span><span>
</span><span id="line-178"></span><span>
</span><span id="line-179"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{Is DEBUG on, are we on Windows, etc?}
*                                                                      *
************************************************************************

These booleans are global constants, set by CPP flags.  They allow us to
recompile a single module (this one) to change whether or not debug output
appears. They sometimes let us avoid even running CPP elsewhere.

It's important that the flags are literal constants (True/False). Then,
with -0, tests of the flags in other modules will simplify to the correct
branch of the conditional, thereby dropping debug code altogether when
the flags are off.
-}</span><span>
</span><span id="line-195"></span><span>
</span><span id="line-196"></span><span class="annot"><a href="GHC.Utils.Misc.html#ghciSupported"><span class="hs-identifier hs-type">ghciSupported</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-cpp">
#if defined(HAVE_INTERNAL_INTERPRETER)
</span><span id="ghciSupported"><span class="annot"><span class="annottext">ghciSupported :: Bool
</span><a href="GHC.Utils.Misc.html#ghciSupported"><span class="hs-identifier hs-var hs-var">ghciSupported</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-cpp">
#else
</span><span class="hs-identifier">ghciSupported</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">False</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-203"></span><span class="annot"><a href="GHC.Utils.Misc.html#debugIsOn"><span class="hs-identifier hs-type">debugIsOn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-cpp">
#if defined(DEBUG)
</span><span class="hs-identifier">debugIsOn</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">True</span><span class="hs-cpp">
#else
</span><span id="debugIsOn"><span class="annot"><span class="annottext">debugIsOn :: Bool
</span><a href="GHC.Utils.Misc.html#debugIsOn"><span class="hs-identifier hs-var hs-var">debugIsOn</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-210"></span><span class="annot"><a href="GHC.Utils.Misc.html#isWindowsHost"><span class="hs-identifier hs-type">isWindowsHost</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-cpp">
#if defined(mingw32_HOST_OS)
</span><span id="isWindowsHost"><span class="annot"><span class="annottext">isWindowsHost :: Bool
</span><a href="GHC.Utils.Misc.html#isWindowsHost"><span class="hs-identifier hs-var hs-var">isWindowsHost</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-cpp">
#else
</span><span class="hs-identifier">isWindowsHost</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">False</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-217"></span><span class="annot"><a href="GHC.Utils.Misc.html#isDarwinHost"><span class="hs-identifier hs-type">isDarwinHost</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-cpp">
#if defined(darwin_HOST_OS)
</span><span class="hs-identifier">isDarwinHost</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">True</span><span class="hs-cpp">
#else
</span><span id="isDarwinHost"><span class="annot"><span class="annottext">isDarwinHost :: Bool
</span><a href="GHC.Utils.Misc.html#isDarwinHost"><span class="hs-identifier hs-var hs-var">isDarwinHost</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-224"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{Miscellaneous higher-order functions}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-231"></span><span>
</span><span id="line-232"></span><span class="hs-comment">-- | Apply a function iff some condition is met.</span><span>
</span><span id="line-233"></span><span id="local-6989586621680780588"><span class="annot"><a href="GHC.Utils.Misc.html#applyWhen"><span class="hs-identifier hs-type">applyWhen</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780588"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780588"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780588"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780588"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-234"></span><span id="applyWhen"><span class="annot"><span class="annottext">applyWhen :: forall a. Bool -&gt; (a -&gt; a) -&gt; a -&gt; a
</span><a href="GHC.Utils.Misc.html#applyWhen"><span class="hs-identifier hs-var hs-var">applyWhen</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span id="local-6989586621680779772"><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621680779772"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680779771"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779771"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621680779772"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779771"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-235"></span><span class="annot"><a href="GHC.Utils.Misc.html#applyWhen"><span class="hs-identifier hs-var">applyWhen</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span>    </span><span class="annot"><span class="annottext">a -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680779770"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779770"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779770"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-236"></span><span>
</span><span id="line-237"></span><span class="hs-comment">-- | A for loop: Compose a function with itself n times.  (nth rather than twice)</span><span>
</span><span id="line-238"></span><span id="local-6989586621680780586"><span class="annot"><a href="GHC.Utils.Misc.html#nTimes"><span class="hs-identifier hs-type">nTimes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780586"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780586"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780586"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780586"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-239"></span><span id="nTimes"><span class="annot"><span class="annottext">nTimes :: forall a. Int -&gt; (a -&gt; a) -&gt; a -&gt; a
</span><a href="GHC.Utils.Misc.html#nTimes"><span class="hs-identifier hs-var hs-var">nTimes</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-240"></span><span class="annot"><a href="GHC.Utils.Misc.html#nTimes"><span class="hs-identifier hs-var">nTimes</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span id="local-6989586621680779761"><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621680779761"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621680779761"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-241"></span><span class="annot"><a href="GHC.Utils.Misc.html#nTimes"><span class="hs-identifier hs-var">nTimes</span></a></span><span> </span><span id="local-6989586621680779760"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779760"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680779759"><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621680779759"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621680779759"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; a) -&gt; (a -&gt; a) -&gt; a -&gt; a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; (a -&gt; a) -&gt; a -&gt; a
forall a. Int -&gt; (a -&gt; a) -&gt; a -&gt; a
</span><a href="GHC.Utils.Misc.html#nTimes"><span class="hs-identifier hs-var">nTimes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779760"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621680779759"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-242"></span><span>
</span><span id="line-243"></span><span id="local-6989586621680780577"><span id="local-6989586621680780578"><span id="local-6989586621680780579"><span class="annot"><a href="GHC.Utils.Misc.html#fstOf3"><span class="hs-identifier hs-type">fstOf3</span></a></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780579"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780578"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780577"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780579"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-244"></span><span id="local-6989586621680780571"><span id="local-6989586621680780572"><span id="local-6989586621680780573"><span class="annot"><a href="GHC.Utils.Misc.html#sndOf3"><span class="hs-identifier hs-type">sndOf3</span></a></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780573"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780572"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780571"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780572"><span class="hs-identifier hs-type">b</span></a></span></span></span></span><span>
</span><span id="line-245"></span><span id="local-6989586621680780565"><span id="local-6989586621680780566"><span id="local-6989586621680780567"><span class="annot"><a href="GHC.Utils.Misc.html#thdOf3"><span class="hs-identifier hs-type">thdOf3</span></a></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780567"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780566"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780565"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780565"><span class="hs-identifier hs-type">c</span></a></span></span></span></span><span>
</span><span id="line-246"></span><span id="fstOf3"><span class="annot"><span class="annottext">fstOf3 :: forall a b c. (a, b, c) -&gt; a
</span><a href="GHC.Utils.Misc.html#fstOf3"><span class="hs-identifier hs-var hs-var">fstOf3</span></a></span></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621680779757"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779757"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">c
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779757"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-247"></span><span id="sndOf3"><span class="annot"><span class="annottext">sndOf3 :: forall a b c. (a, b, c) -&gt; b
</span><a href="GHC.Utils.Misc.html#sndOf3"><span class="hs-identifier hs-var hs-var">sndOf3</span></a></span></span><span>      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621680779756"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779756"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">c
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779756"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-248"></span><span id="thdOf3"><span class="annot"><span class="annottext">thdOf3 :: forall a b c. (a, b, c) -&gt; c
</span><a href="GHC.Utils.Misc.html#thdOf3"><span class="hs-identifier hs-var hs-var">thdOf3</span></a></span></span><span>      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621680779755"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779755"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779755"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-249"></span><span>
</span><span id="line-250"></span><span id="local-6989586621680780558"><span id="local-6989586621680780559"><span id="local-6989586621680780560"><span id="local-6989586621680780561"><span class="annot"><a href="GHC.Utils.Misc.html#fst3"><span class="hs-identifier hs-type">fst3</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780561"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780560"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780561"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780559"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780558"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780560"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780559"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780558"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-251"></span><span id="fst3"><span class="annot"><span class="annottext">fst3 :: forall a d b c. (a -&gt; d) -&gt; (a, b, c) -&gt; (d, b, c)
</span><a href="GHC.Utils.Misc.html#fst3"><span class="hs-identifier hs-var hs-var">fst3</span></a></span></span><span> </span><span id="local-6989586621680779754"><span class="annot"><span class="annottext">a -&gt; d
</span><a href="#local-6989586621680779754"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779753"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779753"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779752"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779752"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779751"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779751"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; d
</span><a href="#local-6989586621680779754"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779753"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779752"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779751"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-252"></span><span>
</span><span id="line-253"></span><span id="local-6989586621680780550"><span id="local-6989586621680780551"><span id="local-6989586621680780552"><span id="local-6989586621680780553"><span class="annot"><a href="GHC.Utils.Misc.html#snd3"><span class="hs-identifier hs-type">snd3</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780553"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780552"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780551"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780553"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780550"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780551"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780552"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780550"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-254"></span><span id="snd3"><span class="annot"><span class="annottext">snd3 :: forall b d a c. (b -&gt; d) -&gt; (a, b, c) -&gt; (a, d, c)
</span><a href="GHC.Utils.Misc.html#snd3"><span class="hs-identifier hs-var hs-var">snd3</span></a></span></span><span> </span><span id="local-6989586621680779750"><span class="annot"><span class="annottext">b -&gt; d
</span><a href="#local-6989586621680779750"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779749"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779749"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779748"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779748"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779747"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779747"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779749"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b -&gt; d
</span><a href="#local-6989586621680779750"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779748"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779747"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-255"></span><span>
</span><span id="line-256"></span><span id="local-6989586621680780542"><span id="local-6989586621680780543"><span id="local-6989586621680780544"><span id="local-6989586621680780545"><span class="annot"><a href="GHC.Utils.Misc.html#third3"><span class="hs-identifier hs-type">third3</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780545"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780544"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780543"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780542"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780545"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780543"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780542"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780544"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-257"></span><span id="third3"><span class="annot"><span class="annottext">third3 :: forall c d a b. (c -&gt; d) -&gt; (a, b, c) -&gt; (a, b, d)
</span><a href="GHC.Utils.Misc.html#third3"><span class="hs-identifier hs-var hs-var">third3</span></a></span></span><span> </span><span id="local-6989586621680779746"><span class="annot"><span class="annottext">c -&gt; d
</span><a href="#local-6989586621680779746"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779745"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779745"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779744"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779744"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779743"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779743"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779745"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779744"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">c -&gt; d
</span><a href="#local-6989586621680779746"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779743"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-258"></span><span>
</span><span id="line-259"></span><span id="local-6989586621680780534"><span id="local-6989586621680780535"><span id="local-6989586621680780536"><span id="local-6989586621680780537"><span class="annot"><a href="GHC.Utils.Misc.html#uncurry3"><span class="hs-identifier hs-type">uncurry3</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780537"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780536"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780535"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780534"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780537"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780536"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780535"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780534"><span class="hs-identifier hs-type">d</span></a></span></span></span></span></span><span>
</span><span id="line-260"></span><span id="uncurry3"><span class="annot"><span class="annottext">uncurry3 :: forall a b c d. (a -&gt; b -&gt; c -&gt; d) -&gt; (a, b, c) -&gt; d
</span><a href="GHC.Utils.Misc.html#uncurry3"><span class="hs-identifier hs-var hs-var">uncurry3</span></a></span></span><span> </span><span id="local-6989586621680779742"><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d
</span><a href="#local-6989586621680779742"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779741"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779741"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779740"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779740"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779739"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779739"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d
</span><a href="#local-6989586621680779742"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779741"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779740"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779739"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-261"></span><span>
</span><span id="line-262"></span><span id="local-6989586621680780527"><span id="local-6989586621680780528"><span id="local-6989586621680780529"><span class="annot"><a href="GHC.Utils.Misc.html#liftFst"><span class="hs-identifier hs-type">liftFst</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780529"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780528"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780529"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780527"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780528"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780527"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-263"></span><span id="liftFst"><span class="annot"><span class="annottext">liftFst :: forall a b c. (a -&gt; b) -&gt; (a, c) -&gt; (b, c)
</span><a href="GHC.Utils.Misc.html#liftFst"><span class="hs-identifier hs-var hs-var">liftFst</span></a></span></span><span> </span><span id="local-6989586621680779738"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680779738"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779737"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779737"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680779736"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779736"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680779738"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779737"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779736"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-264"></span><span>
</span><span id="line-265"></span><span id="local-6989586621680780521"><span id="local-6989586621680780522"><span id="local-6989586621680780523"><span class="annot"><a href="GHC.Utils.Misc.html#liftSnd"><span class="hs-identifier hs-type">liftSnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780523"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780522"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780521"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780523"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780521"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780522"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-266"></span><span id="liftSnd"><span class="annot"><span class="annottext">liftSnd :: forall a b c. (a -&gt; b) -&gt; (c, a) -&gt; (c, b)
</span><a href="GHC.Utils.Misc.html#liftSnd"><span class="hs-identifier hs-var hs-var">liftSnd</span></a></span></span><span> </span><span id="local-6989586621680779735"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680779735"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779734"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779734"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680779733"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779733"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779734"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680779735"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779733"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-267"></span><span>
</span><span id="line-268"></span><span id="local-6989586621680780514"><span id="local-6989586621680780515"><span id="local-6989586621680780516"><span id="local-6989586621680780517"><span class="annot"><a href="GHC.Utils.Misc.html#firstM"><span class="hs-identifier hs-type">firstM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780517"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780516"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780517"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780515"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780516"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780514"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780517"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780515"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780514"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-269"></span><span id="firstM"><span class="annot"><span class="annottext">firstM :: forall (m :: * -&gt; *) a c b.
Monad m =&gt;
(a -&gt; m c) -&gt; (a, b) -&gt; m (c, b)
</span><a href="GHC.Utils.Misc.html#firstM"><span class="hs-identifier hs-var hs-var">firstM</span></a></span></span><span> </span><span id="local-6989586621680779730"><span class="annot"><span class="annottext">a -&gt; m c
</span><a href="#local-6989586621680779730"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779729"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779729"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779728"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779728"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(c -&gt; (c, b)) -&gt; m c -&gt; m (c, b)
forall (m :: * -&gt; *) a1 r. Monad m =&gt; (a1 -&gt; r) -&gt; m a1 -&gt; m r
</span><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier hs-var">liftM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680779727"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779727"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779727"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779728"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; m c
</span><a href="#local-6989586621680779730"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779729"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-270"></span><span>
</span><span id="line-271"></span><span id="local-6989586621680780502"><span id="local-6989586621680780503"><span id="local-6989586621680780504"><span id="local-6989586621680780505"><span id="local-6989586621680780506"><span class="annot"><a href="GHC.Utils.Misc.html#first3M"><span class="hs-identifier hs-type">first3M</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780506"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780505"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780506"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780504"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780505"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780503"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780502"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780506"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780504"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780503"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780502"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span></span></span><span>
</span><span id="line-272"></span><span id="first3M"><span class="annot"><span class="annottext">first3M :: forall (m :: * -&gt; *) a d b c.
Monad m =&gt;
(a -&gt; m d) -&gt; (a, b, c) -&gt; m (d, b, c)
</span><a href="GHC.Utils.Misc.html#first3M"><span class="hs-identifier hs-var hs-var">first3M</span></a></span></span><span> </span><span id="local-6989586621680779724"><span class="annot"><span class="annottext">a -&gt; m d
</span><a href="#local-6989586621680779724"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779723"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779723"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779722"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779722"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779721"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779721"><span class="hs-identifier hs-var">z</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(d -&gt; (d, b, c)) -&gt; m d -&gt; m (d, b, c)
forall (m :: * -&gt; *) a1 r. Monad m =&gt; (a1 -&gt; r) -&gt; m a1 -&gt; m r
</span><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier hs-var">liftM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680779720"><span class="annot"><span class="annottext">d
</span><a href="#local-6989586621680779720"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">d
</span><a href="#local-6989586621680779720"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779722"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779721"><span class="hs-identifier hs-var">z</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; m d
</span><a href="#local-6989586621680779724"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779723"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-273"></span><span>
</span><span id="line-274"></span><span id="local-6989586621680780493"><span id="local-6989586621680780494"><span id="local-6989586621680780495"><span id="local-6989586621680780496"><span class="annot"><a href="GHC.Utils.Misc.html#secondM"><span class="hs-identifier hs-type">secondM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780496"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780495"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780496"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780494"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780493"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780495"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780496"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780493"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780494"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-275"></span><span id="secondM"><span class="annot"><span class="annottext">secondM :: forall (m :: * -&gt; *) b c a.
Monad m =&gt;
(b -&gt; m c) -&gt; (a, b) -&gt; m (a, c)
</span><a href="GHC.Utils.Misc.html#secondM"><span class="hs-identifier hs-var hs-var">secondM</span></a></span></span><span> </span><span id="local-6989586621680779713"><span class="annot"><span class="annottext">b -&gt; m c
</span><a href="#local-6989586621680779713"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779712"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779712"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779711"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779711"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779712"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(c -&gt; (a, c)) -&gt; m c -&gt; m (a, c)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; m c
</span><a href="#local-6989586621680779713"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779711"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-276"></span><span>
</span><span id="line-277"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection[Utils-lists]{General list processing}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-284"></span><span>
</span><span id="line-285"></span><span id="local-6989586621680780483"><span class="annot"><a href="GHC.Utils.Misc.html#filterOut"><span class="hs-identifier hs-type">filterOut</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780483"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780483"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780483"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-286"></span><span class="hs-comment">-- ^ Like filter, only it reverses the sense of the test</span><span>
</span><span id="line-287"></span><span id="filterOut"><span class="annot"><span class="annottext">filterOut :: forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#filterOut"><span class="hs-identifier hs-var hs-var">filterOut</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-288"></span><span class="annot"><a href="GHC.Utils.Misc.html#filterOut"><span class="hs-identifier hs-var">filterOut</span></a></span><span> </span><span id="local-6989586621680779709"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779709"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779708"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779708"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779707"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779707"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779709"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779708"><span class="hs-identifier hs-var">x</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; [a]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#filterOut"><span class="hs-identifier hs-var">filterOut</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779709"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779707"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-289"></span><span>                   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779708"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; [a]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#filterOut"><span class="hs-identifier hs-var">filterOut</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779709"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779707"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-290"></span><span>
</span><span id="line-291"></span><span id="local-6989586621680780478"><span id="local-6989586621680780479"><span id="local-6989586621680780480"><span class="annot"><a href="GHC.Utils.Misc.html#partitionWith"><span class="hs-identifier hs-type">partitionWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780480"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780479"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780478"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780480"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780479"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780478"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-292"></span><span class="hs-comment">-- ^ Uses a function to determine which of two output lists an input element should join</span><span>
</span><span id="line-293"></span><span id="partitionWith"><span class="annot"><span class="annottext">partitionWith :: forall a b c. (a -&gt; Either b c) -&gt; [a] -&gt; ([b], [c])
</span><a href="GHC.Utils.Misc.html#partitionWith"><span class="hs-identifier hs-var hs-var">partitionWith</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Either b c
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-294"></span><span class="annot"><a href="GHC.Utils.Misc.html#partitionWith"><span class="hs-identifier hs-var">partitionWith</span></a></span><span> </span><span id="local-6989586621680779706"><span class="annot"><span class="annottext">a -&gt; Either b c
</span><a href="#local-6989586621680779706"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779705"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779705"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779704"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779704"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; Either b c
</span><a href="#local-6989586621680779706"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779705"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-295"></span><span>                         </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span>  </span><span id="local-6989586621680779703"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779703"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779703"><span class="hs-identifier hs-var">b</span></a></span><span class="annot"><span class="annottext">b -&gt; [b] -&gt; [b]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779702"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621680779701"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-296"></span><span>                         </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621680779700"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779700"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779702"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779700"><span class="hs-identifier hs-var">c</span></a></span><span class="annot"><span class="annottext">c -&gt; [c] -&gt; [c]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621680779701"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-297"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779702"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779702"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680779701"><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621680779701"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Either b c) -&gt; [a] -&gt; ([b], [c])
forall a b c. (a -&gt; Either b c) -&gt; [a] -&gt; ([b], [c])
</span><a href="GHC.Utils.Misc.html#partitionWith"><span class="hs-identifier hs-var">partitionWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Either b c
</span><a href="#local-6989586621680779706"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779704"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-298"></span><span>
</span><span id="line-299"></span><span id="local-6989586621680780474"><span class="annot"><a href="GHC.Utils.Misc.html#chkAppend"><span class="hs-identifier hs-type">chkAppend</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780474"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780474"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780474"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-300"></span><span class="hs-comment">-- Checks for the second argument being empty</span><span>
</span><span id="line-301"></span><span class="hs-comment">-- Used in situations where that situation is common</span><span>
</span><span id="line-302"></span><span id="chkAppend"><span class="annot"><span class="annottext">chkAppend :: forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#chkAppend"><span class="hs-identifier hs-var hs-var">chkAppend</span></a></span></span><span> </span><span id="local-6989586621680779698"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779698"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span id="local-6989586621680779697"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779697"><span class="hs-identifier hs-var">ys</span></a></span></span><span>
</span><span id="line-303"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779697"><span class="hs-identifier hs-var">ys</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779698"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-304"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779698"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779697"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-305"></span><span>
</span><span id="line-306"></span><span class="hs-comment">{-
A paranoid @zip@ (and some @zipWith@ friends) that checks the lists
are of equal length.  Alastair Reid thinks this should only happen if
DEBUGging on; hey, why not?
-}</span><span>
</span><span id="line-311"></span><span>
</span><span id="line-312"></span><span id="local-6989586621680780469"><span id="local-6989586621680780470"><span class="annot"><a href="GHC.Utils.Misc.html#zipEqual"><span class="hs-identifier hs-type">zipEqual</span></a></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780470"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780469"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780470"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780469"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span></span></span><span>
</span><span id="line-313"></span><span id="local-6989586621680780462"><span id="local-6989586621680780463"><span id="local-6989586621680780464"><span class="annot"><a href="GHC.Utils.Misc.html#zipWithEqual"><span class="hs-identifier hs-type">zipWithEqual</span></a></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780464"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680780463"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680780462"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780464"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-glyph">-&gt;</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780463"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span class="hs-glyph">-&gt;</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780462"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span></span></span></span><span>
</span><span id="line-314"></span><span id="local-6989586621680780452"><span id="local-6989586621680780453"><span id="local-6989586621680780454"><span id="local-6989586621680780455"><span class="annot"><a href="GHC.Utils.Misc.html#zipWith3Equal"><span class="hs-identifier hs-type">zipWith3Equal</span></a></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780455"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680780454"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680780453"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680780452"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780455"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-glyph">-&gt;</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780454"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span class="hs-glyph">-&gt;</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780453"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span><span class="hs-glyph">-&gt;</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780452"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">]</span></span></span></span></span><span>
</span><span id="line-315"></span><span id="local-6989586621680780439"><span id="local-6989586621680780440"><span id="local-6989586621680780441"><span id="local-6989586621680780442"><span id="local-6989586621680780443"><span class="annot"><a href="GHC.Utils.Misc.html#zipWith4Equal"><span class="hs-identifier hs-type">zipWith4Equal</span></a></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780443"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680780442"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680780441"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680780440"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680780439"><span class="hs-identifier hs-type">e</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780443"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-glyph">-&gt;</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780442"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span class="hs-glyph">-&gt;</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780441"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span><span class="hs-glyph">-&gt;</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780440"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">]</span><span class="hs-glyph">-&gt;</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780439"><span class="hs-identifier hs-type">e</span></a></span><span class="hs-special">]</span></span></span></span></span></span><span class="hs-cpp">

#if !defined(DEBUG)
</span><span id="zipEqual"><span class="annot"><span class="annottext">zipEqual :: forall a b. String -&gt; [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="GHC.Utils.Misc.html#zipEqual"><span class="hs-identifier hs-var hs-var">zipEqual</span></a></span></span><span>      </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; [(a, b)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span>
</span><span id="line-319"></span><span id="zipWithEqual"><span class="annot"><span class="annottext">zipWithEqual :: forall a b c. String -&gt; (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="GHC.Utils.Misc.html#zipWithEqual"><span class="hs-identifier hs-var hs-var">zipWithEqual</span></a></span></span><span>  </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span>
</span><span id="line-320"></span><span id="zipWith3Equal"><span class="annot"><span class="annottext">zipWith3Equal :: forall a b c d.
String -&gt; (a -&gt; b -&gt; c -&gt; d) -&gt; [a] -&gt; [b] -&gt; [c] -&gt; [d]
</span><a href="GHC.Utils.Misc.html#zipWith3Equal"><span class="hs-identifier hs-var hs-var">zipWith3Equal</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; c -&gt; d) -&gt; [a] -&gt; [b] -&gt; [c] -&gt; [d]
forall a b c d. (a -&gt; b -&gt; c -&gt; d) -&gt; [a] -&gt; [b] -&gt; [c] -&gt; [d]
</span><a href="../../base/src/GHC.List.html#zipWith3"><span class="hs-identifier hs-var">zipWith3</span></a></span><span>
</span><span id="line-321"></span><span id="zipWith4Equal"><span class="annot"><span class="annottext">zipWith4Equal :: forall a b c d e.
String
-&gt; (a -&gt; b -&gt; c -&gt; d -&gt; e) -&gt; [a] -&gt; [b] -&gt; [c] -&gt; [d] -&gt; [e]
</span><a href="GHC.Utils.Misc.html#zipWith4Equal"><span class="hs-identifier hs-var hs-var">zipWith4Equal</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; c -&gt; d -&gt; e) -&gt; [a] -&gt; [b] -&gt; [c] -&gt; [d] -&gt; [e]
forall a b c d e.
(a -&gt; b -&gt; c -&gt; d -&gt; e) -&gt; [a] -&gt; [b] -&gt; [c] -&gt; [d] -&gt; [e]
</span><a href="../../base/src/Data.OldList.html#zipWith4"><span class="hs-identifier hs-var">zipWith4</span></a></span><span class="hs-cpp">
#else
</span><span class="hs-identifier">zipEqual</span><span> </span><span class="hs-identifier">_</span><span>   </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-324"></span><span class="hs-identifier">zipEqual</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">a</span><span class="hs-glyph">:</span><span class="hs-keyword">as</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">b</span><span class="hs-glyph">:</span><span class="hs-identifier">bs</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">a</span><span class="hs-special">,</span><span class="hs-identifier">b</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">:</span><span> </span><span class="hs-identifier">zipEqual</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">bs</span><span>
</span><span id="line-325"></span><span class="hs-identifier">zipEqual</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-identifier">_</span><span>      </span><span class="hs-identifier">_</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">panic</span><span> </span><span class="hs-special">(</span><span class="hs-string">&quot;zipEqual: unequal lists: &quot;</span><span class="hs-operator">++</span><span class="hs-identifier">msg</span><span class="hs-special">)</span><span>
</span><span id="line-326"></span><span>
</span><span id="line-327"></span><span class="hs-identifier">zipWithEqual</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-identifier">z</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">a</span><span class="hs-glyph">:</span><span class="hs-keyword">as</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">b</span><span class="hs-glyph">:</span><span class="hs-identifier">bs</span><span class="hs-special">)</span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">z</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-identifier">b</span><span> </span><span class="hs-glyph">:</span><span> </span><span class="hs-identifier">zipWithEqual</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-identifier">z</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">bs</span><span>
</span><span id="line-328"></span><span class="hs-identifier">zipWithEqual</span><span> </span><span class="hs-identifier">_</span><span>   </span><span class="hs-identifier">_</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-329"></span><span class="hs-identifier">zipWithEqual</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">panic</span><span> </span><span class="hs-special">(</span><span class="hs-string">&quot;zipWithEqual: unequal lists: &quot;</span><span class="hs-operator">++</span><span class="hs-identifier">msg</span><span class="hs-special">)</span><span>
</span><span id="line-330"></span><span>
</span><span id="line-331"></span><span class="hs-identifier">zipWith3Equal</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-identifier">z</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">a</span><span class="hs-glyph">:</span><span class="hs-keyword">as</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">b</span><span class="hs-glyph">:</span><span class="hs-identifier">bs</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">c</span><span class="hs-glyph">:</span><span class="hs-identifier">cs</span><span class="hs-special">)</span><span>
</span><span id="line-332"></span><span>                                </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">z</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-identifier">b</span><span> </span><span class="hs-identifier">c</span><span> </span><span class="hs-glyph">:</span><span> </span><span class="hs-identifier">zipWith3Equal</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-identifier">z</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">bs</span><span> </span><span class="hs-identifier">cs</span><span>
</span><span id="line-333"></span><span class="hs-identifier">zipWith3Equal</span><span> </span><span class="hs-identifier">_</span><span>   </span><span class="hs-identifier">_</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-334"></span><span class="hs-identifier">zipWith3Equal</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span>  </span><span class="hs-identifier">_</span><span>   </span><span class="hs-identifier">_</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">panic</span><span> </span><span class="hs-special">(</span><span class="hs-string">&quot;zipWith3Equal: unequal lists: &quot;</span><span class="hs-operator">++</span><span class="hs-identifier">msg</span><span class="hs-special">)</span><span>
</span><span id="line-335"></span><span>
</span><span id="line-336"></span><span class="hs-identifier">zipWith4Equal</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-identifier">z</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">a</span><span class="hs-glyph">:</span><span class="hs-keyword">as</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">b</span><span class="hs-glyph">:</span><span class="hs-identifier">bs</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">c</span><span class="hs-glyph">:</span><span class="hs-identifier">cs</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">d</span><span class="hs-glyph">:</span><span class="hs-identifier">ds</span><span class="hs-special">)</span><span>
</span><span id="line-337"></span><span>                                </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">z</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-identifier">b</span><span> </span><span class="hs-identifier">c</span><span> </span><span class="hs-identifier">d</span><span> </span><span class="hs-glyph">:</span><span> </span><span class="hs-identifier">zipWith4Equal</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-identifier">z</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">bs</span><span> </span><span class="hs-identifier">cs</span><span> </span><span class="hs-identifier">ds</span><span>
</span><span id="line-338"></span><span class="hs-identifier">zipWith4Equal</span><span> </span><span class="hs-identifier">_</span><span>   </span><span class="hs-identifier">_</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-339"></span><span class="hs-identifier">zipWith4Equal</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span>  </span><span class="hs-identifier">_</span><span>  </span><span class="hs-identifier">_</span><span>  </span><span class="hs-identifier">_</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">panic</span><span> </span><span class="hs-special">(</span><span class="hs-string">&quot;zipWith4Equal: unequal lists: &quot;</span><span class="hs-operator">++</span><span class="hs-identifier">msg</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-342"></span><span class="hs-comment">-- | 'zipLazy' is a kind of 'zip' that is lazy in the second list (observe the ~)</span><span>
</span><span id="line-343"></span><span id="local-6989586621680779691"><span id="local-6989586621680779692"><span class="annot"><a href="GHC.Utils.Misc.html#zipLazy"><span class="hs-identifier hs-type">zipLazy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779692"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779691"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680779692"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680779691"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span></span></span><span>
</span><span id="line-344"></span><span id="zipLazy"><span class="annot"><span class="annottext">zipLazy :: forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="GHC.Utils.Misc.html#zipLazy"><span class="hs-identifier hs-var hs-var">zipLazy</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-345"></span><span class="annot"><a href="GHC.Utils.Misc.html#zipLazy"><span class="hs-identifier hs-var">zipLazy</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779690"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779690"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779689"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779689"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621680779688"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779688"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779687"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779687"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779690"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779688"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(a, b) -&gt; [(a, b)] -&gt; [(a, b)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; [(a, b)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="GHC.Utils.Misc.html#zipLazy"><span class="hs-identifier hs-var">zipLazy</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779689"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779687"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-346"></span><span>
</span><span id="line-347"></span><span class="hs-comment">-- | 'zipWithLazy' is like 'zipWith' but is lazy in the second list.</span><span>
</span><span id="line-348"></span><span class="hs-comment">-- The length of the output is always the same as the length of the first</span><span>
</span><span id="line-349"></span><span class="hs-comment">-- list.</span><span>
</span><span id="line-350"></span><span id="local-6989586621680779684"><span id="local-6989586621680779685"><span id="local-6989586621680779686"><span class="annot"><a href="GHC.Utils.Misc.html#zipWithLazy"><span class="hs-identifier hs-type">zipWithLazy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680779686"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680779685"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680779684"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779686"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779685"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779684"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span></span></span></span><span>
</span><span id="line-351"></span><span id="zipWithLazy"><span class="annot"><span class="annottext">zipWithLazy :: forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="GHC.Utils.Misc.html#zipWithLazy"><span class="hs-identifier hs-var hs-var">zipWithLazy</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-352"></span><span class="annot"><a href="GHC.Utils.Misc.html#zipWithLazy"><span class="hs-identifier hs-var">zipWithLazy</span></a></span><span> </span><span id="local-6989586621680779683"><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621680779683"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779682"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779682"><span class="hs-identifier hs-var">a</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779681"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779681"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621680779680"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779680"><span class="hs-identifier hs-var">b</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779679"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779679"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621680779683"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779682"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779680"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">c -&gt; [c] -&gt; [c]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="GHC.Utils.Misc.html#zipWithLazy"><span class="hs-identifier hs-var">zipWithLazy</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621680779683"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779681"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779679"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-353"></span><span>
</span><span id="line-354"></span><span class="hs-comment">-- | 'zipWith3Lazy' is like 'zipWith3' but is lazy in the second and third lists.</span><span>
</span><span id="line-355"></span><span class="hs-comment">-- The length of the output is always the same as the length of the first</span><span>
</span><span id="line-356"></span><span class="hs-comment">-- list.</span><span>
</span><span id="line-357"></span><span id="local-6989586621680779675"><span id="local-6989586621680779676"><span id="local-6989586621680779677"><span id="local-6989586621680779678"><span class="annot"><a href="GHC.Utils.Misc.html#zipWith3Lazy"><span class="hs-identifier hs-type">zipWith3Lazy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680779678"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680779677"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680779676"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680779675"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779678"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779677"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779676"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779675"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">]</span></span></span></span></span><span>
</span><span id="line-358"></span><span id="zipWith3Lazy"><span class="annot"><span class="annottext">zipWith3Lazy :: forall a b c d. (a -&gt; b -&gt; c -&gt; d) -&gt; [a] -&gt; [b] -&gt; [c] -&gt; [d]
</span><a href="GHC.Utils.Misc.html#zipWith3Lazy"><span class="hs-identifier hs-var hs-var">zipWith3Lazy</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span>       </span><span class="annot"><span class="annottext">[c]
</span><span class="hs-identifier">_</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-359"></span><span class="annot"><a href="GHC.Utils.Misc.html#zipWith3Lazy"><span class="hs-identifier hs-var">zipWith3Lazy</span></a></span><span> </span><span id="local-6989586621680779674"><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d
</span><a href="#local-6989586621680779674"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779673"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779673"><span class="hs-identifier hs-var">a</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779672"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779672"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621680779671"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779671"><span class="hs-identifier hs-var">b</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779670"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779670"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621680779669"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779669"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779668"><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621680779668"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d
</span><a href="#local-6989586621680779674"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779673"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779671"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779669"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">d -&gt; [d] -&gt; [d]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; c -&gt; d) -&gt; [a] -&gt; [b] -&gt; [c] -&gt; [d]
forall a b c d. (a -&gt; b -&gt; c -&gt; d) -&gt; [a] -&gt; [b] -&gt; [c] -&gt; [d]
</span><a href="GHC.Utils.Misc.html#zipWith3Lazy"><span class="hs-identifier hs-var">zipWith3Lazy</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d
</span><a href="#local-6989586621680779674"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779672"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779670"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621680779668"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-360"></span><span>
</span><span id="line-361"></span><span class="hs-comment">-- | 'filterByList' takes a list of Bools and a list of some elements and</span><span>
</span><span id="line-362"></span><span class="hs-comment">-- filters out these elements for which the corresponding value in the list of</span><span>
</span><span id="line-363"></span><span class="hs-comment">-- Bools is False. This function does not check whether the lists have equal</span><span>
</span><span id="line-364"></span><span class="hs-comment">-- length.</span><span>
</span><span id="line-365"></span><span id="local-6989586621680780419"><span class="annot"><a href="GHC.Utils.Misc.html#filterByList"><span class="hs-identifier hs-type">filterByList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780419"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780419"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-366"></span><span id="filterByList"><span class="annot"><span class="annottext">filterByList :: forall a. [Bool] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#filterByList"><span class="hs-identifier hs-var hs-var">filterByList</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779667"><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680779667"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-special">(</span><span id="local-6989586621680779666"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779666"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779665"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779665"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779666"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[Bool] -&gt; [a] -&gt; [a]
forall a. [Bool] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#filterByList"><span class="hs-identifier hs-var">filterByList</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680779667"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779665"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-367"></span><span class="annot"><a href="GHC.Utils.Misc.html#filterByList"><span class="hs-identifier hs-var">filterByList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779664"><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680779664"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779663"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779663"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>     </span><span class="annot"><span class="annottext">[Bool] -&gt; [a] -&gt; [a]
forall a. [Bool] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#filterByList"><span class="hs-identifier hs-var">filterByList</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680779664"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779663"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-368"></span><span class="annot"><a href="GHC.Utils.Misc.html#filterByList"><span class="hs-identifier hs-var">filterByList</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><span class="hs-identifier">_</span></span><span>          </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-369"></span><span>
</span><span id="line-370"></span><span class="hs-comment">-- | 'filterByLists' takes a list of Bools and two lists as input, and</span><span>
</span><span id="line-371"></span><span class="hs-comment">-- outputs a new list consisting of elements from the last two input lists. For</span><span>
</span><span id="line-372"></span><span class="hs-comment">-- each Bool in the list, if it is 'True', then it takes an element from the</span><span>
</span><span id="line-373"></span><span class="hs-comment">-- former list. If it is 'False', it takes an element from the latter list.</span><span>
</span><span id="line-374"></span><span class="hs-comment">-- The elements taken correspond to the index of the Bool in its list.</span><span>
</span><span id="line-375"></span><span class="hs-comment">-- For example:</span><span>
</span><span id="line-376"></span><span class="hs-comment">--</span><span>
</span><span id="line-377"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-378"></span><span class="hs-comment">-- filterByLists [True, False, True, False] \&quot;abcd\&quot; \&quot;wxyz\&quot; = \&quot;axcz\&quot;</span><span>
</span><span id="line-379"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-380"></span><span class="hs-comment">--</span><span>
</span><span id="line-381"></span><span class="hs-comment">-- This function does not check whether the lists have equal length.</span><span>
</span><span id="line-382"></span><span id="local-6989586621680780417"><span class="annot"><a href="GHC.Utils.Misc.html#filterByLists"><span class="hs-identifier hs-type">filterByLists</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780417"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780417"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780417"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-383"></span><span id="filterByLists"><span class="annot"><span class="annottext">filterByLists :: forall a. [Bool] -&gt; [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#filterByLists"><span class="hs-identifier hs-var hs-var">filterByLists</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779662"><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680779662"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-special">(</span><span id="local-6989586621680779661"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779661"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779660"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779660"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779659"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779659"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779661"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[Bool] -&gt; [a] -&gt; [a] -&gt; [a]
forall a. [Bool] -&gt; [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#filterByLists"><span class="hs-identifier hs-var">filterByLists</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680779662"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779660"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779659"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-384"></span><span class="annot"><a href="GHC.Utils.Misc.html#filterByLists"><span class="hs-identifier hs-var">filterByLists</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779658"><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680779658"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779657"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779657"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779656"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779656"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779655"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779655"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779656"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[Bool] -&gt; [a] -&gt; [a] -&gt; [a]
forall a. [Bool] -&gt; [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#filterByLists"><span class="hs-identifier hs-var">filterByLists</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680779658"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779657"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779655"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-385"></span><span class="annot"><a href="GHC.Utils.Misc.html#filterByLists"><span class="hs-identifier hs-var">filterByLists</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><span class="hs-identifier">_</span></span><span>          </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-386"></span><span>
</span><span id="line-387"></span><span class="hs-comment">-- | 'partitionByList' takes a list of Bools and a list of some elements and</span><span>
</span><span id="line-388"></span><span class="hs-comment">-- partitions the list according to the list of Bools. Elements corresponding</span><span>
</span><span id="line-389"></span><span class="hs-comment">-- to 'True' go to the left; elements corresponding to 'False' go to the right.</span><span>
</span><span id="line-390"></span><span class="hs-comment">-- For example, @partitionByList [True, False, True] [1,2,3] == ([1,3], [2])@</span><span>
</span><span id="line-391"></span><span class="hs-comment">-- This function does not check whether the lists have equal</span><span>
</span><span id="line-392"></span><span class="hs-comment">-- length; when one list runs out, the function stops.</span><span>
</span><span id="line-393"></span><span id="local-6989586621680780415"><span class="annot"><a href="GHC.Utils.Misc.html#partitionByList"><span class="hs-identifier hs-type">partitionByList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780415"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780415"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780415"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span><span>
</span><span id="line-394"></span><span id="partitionByList"><span class="annot"><span class="annottext">partitionByList :: forall a. [Bool] -&gt; [a] -&gt; ([a], [a])
</span><a href="GHC.Utils.Misc.html#partitionByList"><span class="hs-identifier hs-var hs-var">partitionByList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [Bool] -&gt; [a] -&gt; ([a], [a])
forall {a}. [a] -&gt; [a] -&gt; [Bool] -&gt; [a] -&gt; ([a], [a])
</span><a href="#local-6989586621680779654"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-395"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-396"></span><span>    </span><span id="local-6989586621680779654"><span class="annot"><span class="annottext">go :: [a] -&gt; [a] -&gt; [Bool] -&gt; [a] -&gt; ([a], [a])
</span><a href="#local-6989586621680779654"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621680779653"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779653"><span class="hs-identifier hs-var">trues</span></a></span></span><span> </span><span id="local-6989586621680779652"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779652"><span class="hs-identifier hs-var">falses</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>  </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680779651"><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680779651"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779650"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779650"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680779649"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779649"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [Bool] -&gt; [a] -&gt; ([a], [a])
</span><a href="#local-6989586621680779654"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779650"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779653"><span class="hs-identifier hs-var">trues</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779652"><span class="hs-identifier hs-var">falses</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680779651"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779649"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-397"></span><span>    </span><span class="annot"><a href="#local-6989586621680779654"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680779648"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779648"><span class="hs-identifier hs-var">trues</span></a></span></span><span> </span><span id="local-6989586621680779647"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779647"><span class="hs-identifier hs-var">falses</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680779646"><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680779646"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779645"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779645"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680779644"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779644"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [Bool] -&gt; [a] -&gt; ([a], [a])
</span><a href="#local-6989586621680779654"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779648"><span class="hs-identifier hs-var">trues</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779645"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779647"><span class="hs-identifier hs-var">falses</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680779646"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779644"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-398"></span><span>    </span><span class="annot"><a href="#local-6989586621680779654"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680779643"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779643"><span class="hs-identifier hs-var">trues</span></a></span></span><span> </span><span id="local-6989586621680779642"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779642"><span class="hs-identifier hs-var">falses</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a] -&gt; [a]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779643"><span class="hs-identifier hs-var">trues</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779642"><span class="hs-identifier hs-var">falses</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-399"></span><span>
</span><span id="line-400"></span><span id="local-6989586621680780409"><span id="local-6989586621680780410"><span id="local-6989586621680780411"><span class="annot"><a href="GHC.Utils.Misc.html#stretchZipWith"><span class="hs-identifier hs-type">stretchZipWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780411"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780410"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780411"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680780410"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680780409"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780411"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780410"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780409"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span></span></span></span><span>
</span><span id="line-401"></span><span class="hs-comment">-- ^ @stretchZipWith p z f xs ys@ stretches @ys@ by inserting @z@ in</span><span>
</span><span id="line-402"></span><span class="hs-comment">-- the places where @p@ returns @True@</span><span>
</span><span id="line-403"></span><span>
</span><span id="line-404"></span><span id="stretchZipWith"><span class="annot"><span class="annottext">stretchZipWith :: forall a b c.
(a -&gt; Bool) -&gt; b -&gt; (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="GHC.Utils.Misc.html#stretchZipWith"><span class="hs-identifier hs-var hs-var">stretchZipWith</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-405"></span><span class="annot"><a href="GHC.Utils.Misc.html#stretchZipWith"><span class="hs-identifier hs-var">stretchZipWith</span></a></span><span> </span><span id="local-6989586621680779640"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779640"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621680779639"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779639"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span id="local-6989586621680779638"><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621680779638"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779637"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779637"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779636"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779636"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680779635"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779635"><span class="hs-identifier hs-var">ys</span></a></span></span><span>
</span><span id="line-406"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779640"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779637"><span class="hs-identifier hs-var">x</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621680779638"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779637"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779639"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">c -&gt; [c] -&gt; [c]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; b -&gt; (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
forall a b c.
(a -&gt; Bool) -&gt; b -&gt; (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="GHC.Utils.Misc.html#stretchZipWith"><span class="hs-identifier hs-var">stretchZipWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779640"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779639"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621680779638"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779636"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779635"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-407"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779635"><span class="hs-identifier hs-var">ys</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-408"></span><span>                </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-409"></span><span>                </span><span class="hs-special">(</span><span id="local-6989586621680779634"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779634"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779633"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779633"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621680779638"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779637"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779634"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">c -&gt; [c] -&gt; [c]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; b -&gt; (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
forall a b c.
(a -&gt; Bool) -&gt; b -&gt; (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="GHC.Utils.Misc.html#stretchZipWith"><span class="hs-identifier hs-var">stretchZipWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779640"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779639"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621680779638"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779636"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779633"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-410"></span><span>
</span><span id="line-411"></span><span id="local-6989586621680780403"><span id="local-6989586621680780404"><span id="local-6989586621680780405"><span class="annot"><a href="GHC.Utils.Misc.html#mapFst"><span class="hs-identifier hs-type">mapFst</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780405"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680780404"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780405"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780403"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780404"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780403"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span></span></span></span><span>
</span><span id="line-412"></span><span id="local-6989586621680780397"><span id="local-6989586621680780398"><span id="local-6989586621680780399"><span class="annot"><a href="GHC.Utils.Misc.html#mapSnd"><span class="hs-identifier hs-type">mapSnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780399"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680780398"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780397"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780399"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780397"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780398"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span></span></span></span><span>
</span><span id="line-413"></span><span>
</span><span id="line-414"></span><span id="mapFst"><span class="annot"><span class="annottext">mapFst :: forall a c b. (a -&gt; c) -&gt; [(a, b)] -&gt; [(c, b)]
</span><a href="GHC.Utils.Misc.html#mapFst"><span class="hs-identifier hs-var hs-var">mapFst</span></a></span></span><span> </span><span id="local-6989586621680779632"><span class="annot"><span class="annottext">a -&gt; c
</span><a href="#local-6989586621680779632"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680779631"><span class="annot"><span class="annottext">[(a, b)]
</span><a href="#local-6989586621680779631"><span class="hs-identifier hs-var">xys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; c
</span><a href="#local-6989586621680779632"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779630"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779629"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779630"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779630"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680779629"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779629"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(a, b)]
</span><a href="#local-6989586621680779631"><span class="hs-identifier hs-var">xys</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-415"></span><span id="mapSnd"><span class="annot"><span class="annottext">mapSnd :: forall b c a. (b -&gt; c) -&gt; [(a, b)] -&gt; [(a, c)]
</span><a href="GHC.Utils.Misc.html#mapSnd"><span class="hs-identifier hs-var hs-var">mapSnd</span></a></span></span><span> </span><span id="local-6989586621680779628"><span class="annot"><span class="annottext">b -&gt; c
</span><a href="#local-6989586621680779628"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680779627"><span class="annot"><span class="annottext">[(a, b)]
</span><a href="#local-6989586621680779627"><span class="hs-identifier hs-var">xys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779626"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b -&gt; c
</span><a href="#local-6989586621680779628"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779625"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779626"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779626"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680779625"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779625"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(a, b)]
</span><a href="#local-6989586621680779627"><span class="hs-identifier hs-var">xys</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-416"></span><span>
</span><span id="line-417"></span><span id="local-6989586621680780391"><span id="local-6989586621680780392"><span id="local-6989586621680780393"><span class="annot"><a href="GHC.Utils.Misc.html#mapAndUnzip"><span class="hs-identifier hs-type">mapAndUnzip</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780393"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780392"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780391"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780393"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780392"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780391"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-418"></span><span>
</span><span id="line-419"></span><span id="mapAndUnzip"><span class="annot"><span class="annottext">mapAndUnzip :: forall a b c. (a -&gt; (b, c)) -&gt; [a] -&gt; ([b], [c])
</span><a href="GHC.Utils.Misc.html#mapAndUnzip"><span class="hs-identifier hs-var hs-var">mapAndUnzip</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; (b, c)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-420"></span><span class="annot"><a href="GHC.Utils.Misc.html#mapAndUnzip"><span class="hs-identifier hs-var">mapAndUnzip</span></a></span><span> </span><span id="local-6989586621680779624"><span class="annot"><span class="annottext">a -&gt; (b, c)
</span><a href="#local-6989586621680779624"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779623"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779623"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779622"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779622"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-421"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779621"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779621"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">,</span><span>  </span><span id="local-6989586621680779620"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779620"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; (b, c)
</span><a href="#local-6989586621680779624"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779623"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-422"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680779619"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779619"><span class="hs-identifier hs-var">rs1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779618"><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621680779618"><span class="hs-identifier hs-var">rs2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; (b, c)) -&gt; [a] -&gt; ([b], [c])
forall a b c. (a -&gt; (b, c)) -&gt; [a] -&gt; ([b], [c])
</span><a href="GHC.Utils.Misc.html#mapAndUnzip"><span class="hs-identifier hs-var">mapAndUnzip</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; (b, c)
</span><a href="#local-6989586621680779624"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779622"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-423"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-424"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779621"><span class="hs-identifier hs-var">r1</span></a></span><span class="annot"><span class="annottext">b -&gt; [b] -&gt; [b]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779619"><span class="hs-identifier hs-var">rs1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779620"><span class="hs-identifier hs-var">r2</span></a></span><span class="annot"><span class="annottext">c -&gt; [c] -&gt; [c]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621680779618"><span class="hs-identifier hs-var">rs2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-425"></span><span>
</span><span id="line-426"></span><span id="local-6989586621680780384"><span id="local-6989586621680780385"><span id="local-6989586621680780386"><span id="local-6989586621680780387"><span class="annot"><a href="GHC.Utils.Misc.html#mapAndUnzip3"><span class="hs-identifier hs-type">mapAndUnzip3</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780387"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780386"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780385"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780384"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780387"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780386"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780385"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780384"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-427"></span><span>
</span><span id="line-428"></span><span id="mapAndUnzip3"><span class="annot"><span class="annottext">mapAndUnzip3 :: forall a b c d. (a -&gt; (b, c, d)) -&gt; [a] -&gt; ([b], [c], [d])
</span><a href="GHC.Utils.Misc.html#mapAndUnzip3"><span class="hs-identifier hs-var hs-var">mapAndUnzip3</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; (b, c, d)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-429"></span><span class="annot"><a href="GHC.Utils.Misc.html#mapAndUnzip3"><span class="hs-identifier hs-var">mapAndUnzip3</span></a></span><span> </span><span id="local-6989586621680779617"><span class="annot"><span class="annottext">a -&gt; (b, c, d)
</span><a href="#local-6989586621680779617"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779616"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779616"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779615"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779615"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-430"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779614"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779614"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">,</span><span>  </span><span id="local-6989586621680779613"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779613"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">,</span><span>  </span><span id="local-6989586621680779612"><span class="annot"><span class="annottext">d
</span><a href="#local-6989586621680779612"><span class="hs-identifier hs-var">r3</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; (b, c, d)
</span><a href="#local-6989586621680779617"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779616"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-431"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680779611"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779611"><span class="hs-identifier hs-var">rs1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779610"><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621680779610"><span class="hs-identifier hs-var">rs2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779609"><span class="annot"><span class="annottext">[d]
</span><a href="#local-6989586621680779609"><span class="hs-identifier hs-var">rs3</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; (b, c, d)) -&gt; [a] -&gt; ([b], [c], [d])
forall a b c d. (a -&gt; (b, c, d)) -&gt; [a] -&gt; ([b], [c], [d])
</span><a href="GHC.Utils.Misc.html#mapAndUnzip3"><span class="hs-identifier hs-var">mapAndUnzip3</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; (b, c, d)
</span><a href="#local-6989586621680779617"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779615"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-432"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-433"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779614"><span class="hs-identifier hs-var">r1</span></a></span><span class="annot"><span class="annottext">b -&gt; [b] -&gt; [b]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779611"><span class="hs-identifier hs-var">rs1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779613"><span class="hs-identifier hs-var">r2</span></a></span><span class="annot"><span class="annottext">c -&gt; [c] -&gt; [c]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621680779610"><span class="hs-identifier hs-var">rs2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">d
</span><a href="#local-6989586621680779612"><span class="hs-identifier hs-var">r3</span></a></span><span class="annot"><span class="annottext">d -&gt; [d] -&gt; [d]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[d]
</span><a href="#local-6989586621680779609"><span class="hs-identifier hs-var">rs3</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-434"></span><span>
</span><span id="line-435"></span><span id="local-6989586621680780376"><span id="local-6989586621680780377"><span id="local-6989586621680780378"><span id="local-6989586621680780379"><span class="annot"><a href="GHC.Utils.Misc.html#zipWithAndUnzip"><span class="hs-identifier hs-type">zipWithAndUnzip</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780379"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780378"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780377"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780376"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780379"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780378"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780377"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780376"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-436"></span><span id="zipWithAndUnzip"><span class="annot"><span class="annottext">zipWithAndUnzip :: forall a b c d. (a -&gt; b -&gt; (c, d)) -&gt; [a] -&gt; [b] -&gt; ([c], [d])
</span><a href="GHC.Utils.Misc.html#zipWithAndUnzip"><span class="hs-identifier hs-var hs-var">zipWithAndUnzip</span></a></span></span><span> </span><span id="local-6989586621680779608"><span class="annot"><span class="annottext">a -&gt; b -&gt; (c, d)
</span><a href="#local-6989586621680779608"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779607"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779607"><span class="hs-identifier hs-var">a</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779606"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779606"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779605"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779605"><span class="hs-identifier hs-var">b</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779604"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779604"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-437"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779603"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779603"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">,</span><span>  </span><span id="local-6989586621680779602"><span class="annot"><span class="annottext">d
</span><a href="#local-6989586621680779602"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; (c, d)
</span><a href="#local-6989586621680779608"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779607"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779605"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-438"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680779601"><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621680779601"><span class="hs-identifier hs-var">rs1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779600"><span class="annot"><span class="annottext">[d]
</span><a href="#local-6989586621680779600"><span class="hs-identifier hs-var">rs2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; (c, d)) -&gt; [a] -&gt; [b] -&gt; ([c], [d])
forall a b c d. (a -&gt; b -&gt; (c, d)) -&gt; [a] -&gt; [b] -&gt; ([c], [d])
</span><a href="GHC.Utils.Misc.html#zipWithAndUnzip"><span class="hs-identifier hs-var">zipWithAndUnzip</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; (c, d)
</span><a href="#local-6989586621680779608"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779606"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779604"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-439"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-440"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680779603"><span class="hs-identifier hs-var">r1</span></a></span><span class="annot"><span class="annottext">c -&gt; [c] -&gt; [c]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621680779601"><span class="hs-identifier hs-var">rs1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">d
</span><a href="#local-6989586621680779602"><span class="hs-identifier hs-var">r2</span></a></span><span class="annot"><span class="annottext">d -&gt; [d] -&gt; [d]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[d]
</span><a href="#local-6989586621680779600"><span class="hs-identifier hs-var">rs2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-441"></span><span class="annot"><a href="GHC.Utils.Misc.html#zipWithAndUnzip"><span class="hs-identifier hs-var">zipWithAndUnzip</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; (c, d)
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-442"></span><span>
</span><span id="line-443"></span><span class="hs-comment">-- | This has the effect of making the two lists have equal length by dropping</span><span>
</span><span id="line-444"></span><span class="hs-comment">-- the tail of the longer one.</span><span>
</span><span id="line-445"></span><span id="local-6989586621680780370"><span id="local-6989586621680780371"><span class="annot"><a href="GHC.Utils.Misc.html#zipAndUnzip"><span class="hs-identifier hs-type">zipAndUnzip</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780371"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780370"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780371"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780370"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span></span><span>
</span><span id="line-446"></span><span id="zipAndUnzip"><span class="annot"><span class="annottext">zipAndUnzip :: forall a b. [a] -&gt; [b] -&gt; ([a], [b])
</span><a href="GHC.Utils.Misc.html#zipAndUnzip"><span class="hs-identifier hs-var hs-var">zipAndUnzip</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779599"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779599"><span class="hs-identifier hs-var">a</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779598"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779598"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779597"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779597"><span class="hs-identifier hs-var">b</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779596"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779596"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-447"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779595"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779595"><span class="hs-identifier hs-var">rs1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779594"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779594"><span class="hs-identifier hs-var">rs2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; ([a], [b])
forall a b. [a] -&gt; [b] -&gt; ([a], [b])
</span><a href="GHC.Utils.Misc.html#zipAndUnzip"><span class="hs-identifier hs-var">zipAndUnzip</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779598"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779596"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-448"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-449"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779599"><span class="hs-identifier hs-var">a</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779595"><span class="hs-identifier hs-var">rs1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779597"><span class="hs-identifier hs-var">b</span></a></span><span class="annot"><span class="annottext">b -&gt; [b] -&gt; [b]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779594"><span class="hs-identifier hs-var">rs2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-450"></span><span class="annot"><a href="GHC.Utils.Misc.html#zipAndUnzip"><span class="hs-identifier hs-var">zipAndUnzip</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-451"></span><span>
</span><span id="line-452"></span><span class="hs-comment">-- | @atLength atLen atEnd ls n@ unravels list @ls@ to position @n@. Precisely:</span><span>
</span><span id="line-453"></span><span class="hs-comment">--</span><span>
</span><span id="line-454"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-455"></span><span class="hs-comment">--  atLength atLenPred atEndPred ls n</span><span>
</span><span id="line-456"></span><span class="hs-comment">--   | n &lt; 0         = atLenPred ls</span><span>
</span><span id="line-457"></span><span class="hs-comment">--   | length ls &lt; n = atEndPred (n - length ls)</span><span>
</span><span id="line-458"></span><span class="hs-comment">--   | otherwise     = atLenPred (drop n ls)</span><span>
</span><span id="line-459"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-460"></span><span id="local-6989586621680780366"><span id="local-6989586621680780367"><span class="annot"><a href="GHC.Utils.Misc.html#atLength"><span class="hs-identifier hs-type">atLength</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780367"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780366"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span>   </span><span class="hs-comment">-- Called when length ls &gt;= n, passed (drop n ls)</span><span>
</span><span id="line-461"></span><span>                         </span><span class="hs-comment">--    NB: arg passed to this function may be []</span><span>
</span><span id="line-462"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780366"><span class="hs-identifier hs-type">b</span></a></span><span>            </span><span class="hs-comment">-- Called when length ls &lt;  n</span><span>
</span><span id="line-463"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780367"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-464"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-465"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780366"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-466"></span><span id="atLength"><span class="annot"><span class="annottext">atLength :: forall a b. ([a] -&gt; b) -&gt; b -&gt; [a] -&gt; Int -&gt; b
</span><a href="GHC.Utils.Misc.html#atLength"><span class="hs-identifier hs-var hs-var">atLength</span></a></span></span><span> </span><span id="local-6989586621680779589"><span class="annot"><span class="annottext">[a] -&gt; b
</span><a href="#local-6989586621680779589"><span class="hs-identifier hs-var">atLenPred</span></a></span></span><span> </span><span id="local-6989586621680779588"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779588"><span class="hs-identifier hs-var">atEnd</span></a></span></span><span> </span><span id="local-6989586621680779587"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779587"><span class="hs-identifier hs-var">ls0</span></a></span></span><span> </span><span id="local-6989586621680779586"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779586"><span class="hs-identifier hs-var">n0</span></a></span></span><span>
</span><span id="line-467"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779586"><span class="hs-identifier hs-var">n0</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; b
</span><a href="#local-6989586621680779589"><span class="hs-identifier hs-var">atLenPred</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779587"><span class="hs-identifier hs-var">ls0</span></a></span><span>
</span><span id="line-468"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [a] -&gt; b
forall {t}. (Eq t, Num t) =&gt; t -&gt; [a] -&gt; b
</span><a href="#local-6989586621680779584"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779586"><span class="hs-identifier hs-var">n0</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779587"><span class="hs-identifier hs-var">ls0</span></a></span><span>
</span><span id="line-469"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-470"></span><span>    </span><span class="hs-comment">-- go's first arg n &gt;= 0</span><span>
</span><span id="line-471"></span><span>    </span><span id="local-6989586621680779584"><span class="annot"><span class="annottext">go :: t -&gt; [a] -&gt; b
</span><a href="#local-6989586621680779584"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-number">0</span></span><span> </span><span id="local-6989586621680779577"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779577"><span class="hs-identifier hs-var">ls</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; b
</span><a href="#local-6989586621680779589"><span class="hs-identifier hs-var">atLenPred</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779577"><span class="hs-identifier hs-var">ls</span></a></span><span>
</span><span id="line-472"></span><span>    </span><span class="annot"><a href="#local-6989586621680779584"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779588"><span class="hs-identifier hs-var">atEnd</span></a></span><span>           </span><span class="hs-comment">-- n &gt; 0 here</span><span>
</span><span id="line-473"></span><span>    </span><span class="annot"><a href="#local-6989586621680779584"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680779576"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680779576"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779575"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779575"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; [a] -&gt; b
</span><a href="#local-6989586621680779584"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680779576"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">t -&gt; t -&gt; t
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">t
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779575"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-474"></span><span>
</span><span id="line-475"></span><span class="hs-comment">-- Some special cases of atLength:</span><span>
</span><span id="line-476"></span><span>
</span><span id="line-477"></span><span class="hs-comment">-- | @(lengthExceeds xs n) = (length xs &gt; n)@</span><span>
</span><span id="line-478"></span><span id="local-6989586621680780361"><span class="annot"><a href="GHC.Utils.Misc.html#lengthExceeds"><span class="hs-identifier hs-type">lengthExceeds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780361"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-479"></span><span id="lengthExceeds"><span class="annot"><span class="annottext">lengthExceeds :: forall a. [a] -&gt; Int -&gt; Bool
</span><a href="GHC.Utils.Misc.html#lengthExceeds"><span class="hs-identifier hs-var hs-var">lengthExceeds</span></a></span></span><span> </span><span id="local-6989586621680779572"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779572"><span class="hs-identifier hs-var">lst</span></a></span></span><span> </span><span id="local-6989586621680779571"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779571"><span class="hs-identifier hs-var">n</span></a></span></span><span>
</span><span id="line-480"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779571"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-481"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-482"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-483"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([a] -&gt; Bool) -&gt; Bool -&gt; [a] -&gt; Int -&gt; Bool
forall a b. ([a] -&gt; b) -&gt; b -&gt; [a] -&gt; Int -&gt; b
</span><a href="GHC.Utils.Misc.html#atLength"><span class="hs-identifier hs-var">atLength</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Bool
forall a. [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#notNull"><span class="hs-identifier hs-var">notNull</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779572"><span class="hs-identifier hs-var">lst</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779571"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-484"></span><span>
</span><span id="line-485"></span><span class="hs-comment">-- | @(lengthAtLeast xs n) = (length xs &gt;= n)@</span><span>
</span><span id="line-486"></span><span id="local-6989586621680779570"><span class="annot"><a href="GHC.Utils.Misc.html#lengthAtLeast"><span class="hs-identifier hs-type">lengthAtLeast</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779570"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-487"></span><span id="lengthAtLeast"><span class="annot"><span class="annottext">lengthAtLeast :: forall a. [a] -&gt; Int -&gt; Bool
</span><a href="GHC.Utils.Misc.html#lengthAtLeast"><span class="hs-identifier hs-var hs-var">lengthAtLeast</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([a] -&gt; Bool) -&gt; Bool -&gt; [a] -&gt; Int -&gt; Bool
forall a b. ([a] -&gt; b) -&gt; b -&gt; [a] -&gt; Int -&gt; b
</span><a href="GHC.Utils.Misc.html#atLength"><span class="hs-identifier hs-var">atLength</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; [a] -&gt; Bool
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-488"></span><span>
</span><span id="line-489"></span><span class="hs-comment">-- | @(lengthIs xs n) = (length xs == n)@</span><span>
</span><span id="line-490"></span><span id="local-6989586621680779568"><span class="annot"><a href="GHC.Utils.Misc.html#lengthIs"><span class="hs-identifier hs-type">lengthIs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779568"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-491"></span><span id="lengthIs"><span class="annot"><span class="annottext">lengthIs :: forall a. [a] -&gt; Int -&gt; Bool
</span><a href="GHC.Utils.Misc.html#lengthIs"><span class="hs-identifier hs-var hs-var">lengthIs</span></a></span></span><span> </span><span id="local-6989586621680779564"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779564"><span class="hs-identifier hs-var">lst</span></a></span></span><span> </span><span id="local-6989586621680779563"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779563"><span class="hs-identifier hs-var">n</span></a></span></span><span>
</span><span id="line-492"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779563"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-493"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-494"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-495"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([a] -&gt; Bool) -&gt; Bool -&gt; [a] -&gt; Int -&gt; Bool
forall a b. ([a] -&gt; b) -&gt; b -&gt; [a] -&gt; Int -&gt; b
</span><a href="GHC.Utils.Misc.html#atLength"><span class="hs-identifier hs-var">atLength</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779564"><span class="hs-identifier hs-var">lst</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779563"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-496"></span><span>
</span><span id="line-497"></span><span class="hs-comment">-- | @(lengthIsNot xs n) = (length xs /= n)@</span><span>
</span><span id="line-498"></span><span id="local-6989586621680779562"><span class="annot"><a href="GHC.Utils.Misc.html#lengthIsNot"><span class="hs-identifier hs-type">lengthIsNot</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779562"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-499"></span><span id="lengthIsNot"><span class="annot"><span class="annottext">lengthIsNot :: forall a. [a] -&gt; Int -&gt; Bool
</span><a href="GHC.Utils.Misc.html#lengthIsNot"><span class="hs-identifier hs-var hs-var">lengthIsNot</span></a></span></span><span> </span><span id="local-6989586621680779559"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779559"><span class="hs-identifier hs-var">lst</span></a></span></span><span> </span><span id="local-6989586621680779558"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779558"><span class="hs-identifier hs-var">n</span></a></span></span><span>
</span><span id="line-500"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779558"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-501"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([a] -&gt; Bool) -&gt; Bool -&gt; [a] -&gt; Int -&gt; Bool
forall a b. ([a] -&gt; b) -&gt; b -&gt; [a] -&gt; Int -&gt; b
</span><a href="GHC.Utils.Misc.html#atLength"><span class="hs-identifier hs-var">atLength</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Bool
forall a. [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#notNull"><span class="hs-identifier hs-var">notNull</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779559"><span class="hs-identifier hs-var">lst</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779558"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-502"></span><span>
</span><span id="line-503"></span><span class="hs-comment">-- | @(lengthAtMost xs n) = (length xs &lt;= n)@</span><span>
</span><span id="line-504"></span><span id="local-6989586621680779557"><span class="annot"><a href="GHC.Utils.Misc.html#lengthAtMost"><span class="hs-identifier hs-type">lengthAtMost</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779557"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-505"></span><span id="lengthAtMost"><span class="annot"><span class="annottext">lengthAtMost :: forall a. [a] -&gt; Int -&gt; Bool
</span><a href="GHC.Utils.Misc.html#lengthAtMost"><span class="hs-identifier hs-var hs-var">lengthAtMost</span></a></span></span><span> </span><span id="local-6989586621680779553"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779553"><span class="hs-identifier hs-var">lst</span></a></span></span><span> </span><span id="local-6989586621680779552"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779552"><span class="hs-identifier hs-var">n</span></a></span></span><span>
</span><span id="line-506"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779552"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-507"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-508"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-509"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([a] -&gt; Bool) -&gt; Bool -&gt; [a] -&gt; Int -&gt; Bool
forall a b. ([a] -&gt; b) -&gt; b -&gt; [a] -&gt; Int -&gt; b
</span><a href="GHC.Utils.Misc.html#atLength"><span class="hs-identifier hs-var">atLength</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779553"><span class="hs-identifier hs-var">lst</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779552"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-510"></span><span>
</span><span id="line-511"></span><span class="hs-comment">-- | @(lengthLessThan xs n) == (length xs &lt; n)@</span><span>
</span><span id="line-512"></span><span id="local-6989586621680779551"><span class="annot"><a href="GHC.Utils.Misc.html#lengthLessThan"><span class="hs-identifier hs-type">lengthLessThan</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779551"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-513"></span><span id="lengthLessThan"><span class="annot"><span class="annottext">lengthLessThan :: forall a. [a] -&gt; Int -&gt; Bool
</span><a href="GHC.Utils.Misc.html#lengthLessThan"><span class="hs-identifier hs-var hs-var">lengthLessThan</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([a] -&gt; Bool) -&gt; Bool -&gt; [a] -&gt; Int -&gt; Bool
forall a b. ([a] -&gt; b) -&gt; b -&gt; [a] -&gt; Int -&gt; b
</span><a href="GHC.Utils.Misc.html#atLength"><span class="hs-identifier hs-var">atLength</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; [a] -&gt; Bool
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-514"></span><span>
</span><span id="line-515"></span><span id="local-6989586621680780351"><span class="annot"><a href="GHC.Utils.Misc.html#listLengthCmp"><span class="hs-identifier hs-type">listLengthCmp</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780351"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ordering</span></span></span><span>
</span><span id="line-516"></span><span id="listLengthCmp"><span class="annot"><span class="annottext">listLengthCmp :: forall a. [a] -&gt; Int -&gt; Ordering
</span><a href="GHC.Utils.Misc.html#listLengthCmp"><span class="hs-identifier hs-var hs-var">listLengthCmp</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([a] -&gt; Ordering) -&gt; Ordering -&gt; [a] -&gt; Int -&gt; Ordering
forall a b. ([a] -&gt; b) -&gt; b -&gt; [a] -&gt; Int -&gt; b
</span><a href="GHC.Utils.Misc.html#atLength"><span class="hs-identifier hs-var">atLength</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Ordering
forall {a}. [a] -&gt; Ordering
</span><a href="#local-6989586621680779550"><span class="hs-identifier hs-var">atLen</span></a></span><span> </span><span class="annot"><span class="annottext">Ordering
</span><a href="#local-6989586621680779549"><span class="hs-identifier hs-var">atEnd</span></a></span><span>
</span><span id="line-517"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-518"></span><span>  </span><span id="local-6989586621680779549"><span class="annot"><span class="annottext">atEnd :: Ordering
</span><a href="#local-6989586621680779549"><span class="hs-identifier hs-var hs-var">atEnd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span>    </span><span class="hs-comment">-- Not yet seen 'n' elts, so list length is &lt; n.</span><span>
</span><span id="line-519"></span><span>
</span><span id="line-520"></span><span>  </span><span id="local-6989586621680779550"><span class="annot"><span class="annottext">atLen :: [a] -&gt; Ordering
</span><a href="#local-6989586621680779550"><span class="hs-identifier hs-var hs-var">atLen</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span>
</span><span id="line-521"></span><span>  </span><span class="annot"><a href="#local-6989586621680779550"><span class="hs-identifier hs-var">atLen</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span>
</span><span id="line-522"></span><span>
</span><span id="line-523"></span><span id="local-6989586621680780347"><span id="local-6989586621680780348"><span class="annot"><a href="GHC.Utils.Misc.html#equalLength"><span class="hs-identifier hs-type">equalLength</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780348"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780347"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span></span><span>
</span><span id="line-524"></span><span class="hs-comment">-- ^ True if length xs == length ys</span><span>
</span><span id="line-525"></span><span id="equalLength"><span class="annot"><span class="annottext">equalLength :: forall a b. [a] -&gt; [b] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#equalLength"><span class="hs-identifier hs-var hs-var">equalLength</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-526"></span><span class="annot"><a href="GHC.Utils.Misc.html#equalLength"><span class="hs-identifier hs-var">equalLength</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779548"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779548"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779547"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779547"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; Bool
forall a b. [a] -&gt; [b] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#equalLength"><span class="hs-identifier hs-var">equalLength</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779548"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779547"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-527"></span><span class="annot"><a href="GHC.Utils.Misc.html#equalLength"><span class="hs-identifier hs-var">equalLength</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-528"></span><span>
</span><span id="line-529"></span><span id="local-6989586621680780343"><span id="local-6989586621680780344"><span class="annot"><a href="GHC.Utils.Misc.html#compareLength"><span class="hs-identifier hs-type">compareLength</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780344"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780343"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ordering</span></span></span></span><span>
</span><span id="line-530"></span><span id="compareLength"><span class="annot"><span class="annottext">compareLength :: forall a b. [a] -&gt; [b] -&gt; Ordering
</span><a href="GHC.Utils.Misc.html#compareLength"><span class="hs-identifier hs-var hs-var">compareLength</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span>
</span><span id="line-531"></span><span class="annot"><a href="GHC.Utils.Misc.html#compareLength"><span class="hs-identifier hs-var">compareLength</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779546"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779546"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779545"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779545"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; Ordering
forall a b. [a] -&gt; [b] -&gt; Ordering
</span><a href="GHC.Utils.Misc.html#compareLength"><span class="hs-identifier hs-var">compareLength</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779546"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779545"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-532"></span><span class="annot"><a href="GHC.Utils.Misc.html#compareLength"><span class="hs-identifier hs-var">compareLength</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span>
</span><span id="line-533"></span><span class="annot"><a href="GHC.Utils.Misc.html#compareLength"><span class="hs-identifier hs-var">compareLength</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span>
</span><span id="line-534"></span><span>
</span><span id="line-535"></span><span id="local-6989586621680779543"><span id="local-6989586621680779544"><span class="annot"><a href="GHC.Utils.Misc.html#leLength"><span class="hs-identifier hs-type">leLength</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779544"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779543"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span></span><span>
</span><span id="line-536"></span><span class="hs-comment">-- ^ True if length xs &lt;= length ys</span><span>
</span><span id="line-537"></span><span id="leLength"><span class="annot"><span class="annottext">leLength :: forall a b. [a] -&gt; [b] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#leLength"><span class="hs-identifier hs-var hs-var">leLength</span></a></span></span><span> </span><span id="local-6989586621680779542"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779542"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span id="local-6989586621680779541"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779541"><span class="hs-identifier hs-var">ys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; Ordering
forall a b. [a] -&gt; [b] -&gt; Ordering
</span><a href="GHC.Utils.Misc.html#compareLength"><span class="hs-identifier hs-var">compareLength</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779542"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779541"><span class="hs-identifier hs-var">ys</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-538"></span><span>                   </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-539"></span><span>                   </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-540"></span><span>                   </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-541"></span><span>
</span><span id="line-542"></span><span id="local-6989586621680779539"><span id="local-6989586621680779540"><span class="annot"><a href="GHC.Utils.Misc.html#ltLength"><span class="hs-identifier hs-type">ltLength</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779540"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779539"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span></span><span>
</span><span id="line-543"></span><span class="hs-comment">-- ^ True if length xs &lt; length ys</span><span>
</span><span id="line-544"></span><span id="ltLength"><span class="annot"><span class="annottext">ltLength :: forall a b. [a] -&gt; [b] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#ltLength"><span class="hs-identifier hs-var hs-var">ltLength</span></a></span></span><span> </span><span id="local-6989586621680779538"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779538"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span id="local-6989586621680779537"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779537"><span class="hs-identifier hs-var">ys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; Ordering
forall a b. [a] -&gt; [b] -&gt; Ordering
</span><a href="GHC.Utils.Misc.html#compareLength"><span class="hs-identifier hs-var">compareLength</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779538"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779537"><span class="hs-identifier hs-var">ys</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-545"></span><span>                   </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-546"></span><span>                   </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-547"></span><span>                   </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-548"></span><span>
</span><span id="line-549"></span><span class="hs-comment">----------------------------</span><span>
</span><span id="line-550"></span><span id="local-6989586621680780336"><span class="annot"><a href="GHC.Utils.Misc.html#singleton"><span class="hs-identifier hs-type">singleton</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680780336"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780336"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-551"></span><span id="singleton"><span class="annot"><span class="annottext">singleton :: forall a. a -&gt; [a]
</span><a href="GHC.Utils.Misc.html#singleton"><span class="hs-identifier hs-var hs-var">singleton</span></a></span></span><span> </span><span id="local-6989586621680779536"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779536"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779536"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-552"></span><span>
</span><span id="line-553"></span><span id="local-6989586621680779535"><span class="annot"><a href="GHC.Utils.Misc.html#isSingleton"><span class="hs-identifier hs-type">isSingleton</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779535"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-554"></span><span id="isSingleton"><span class="annot"><span class="annottext">isSingleton :: forall a. [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#isSingleton"><span class="hs-identifier hs-var hs-var">isSingleton</span></a></span></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-555"></span><span class="annot"><a href="GHC.Utils.Misc.html#isSingleton"><span class="hs-identifier hs-var">isSingleton</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-556"></span><span>
</span><span id="line-557"></span><span id="local-6989586621680780359"><span class="annot"><a href="GHC.Utils.Misc.html#notNull"><span class="hs-identifier hs-type">notNull</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780359"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-558"></span><span id="notNull"><span class="annot"><span class="annottext">notNull :: forall a. [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#notNull"><span class="hs-identifier hs-var hs-var">notNull</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-559"></span><span class="annot"><a href="GHC.Utils.Misc.html#notNull"><span class="hs-identifier hs-var">notNull</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-560"></span><span>
</span><span id="line-561"></span><span id="local-6989586621680780332"><span class="annot"><a href="GHC.Utils.Misc.html#only"><span class="hs-identifier hs-type">only</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780332"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780332"><span class="hs-identifier hs-type">a</span></a></span></span><span class="hs-cpp">
#if defined(DEBUG)
</span><span class="hs-identifier">only</span><span> </span><span class="hs-special">[</span><span class="hs-identifier">a</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">a</span><span class="hs-cpp">
#else
</span><span id="only"><span class="annot"><span class="annottext">only :: forall a. [a] -&gt; a
</span><a href="GHC.Utils.Misc.html#only"><span class="hs-identifier hs-var hs-var">only</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779534"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779534"><span class="hs-identifier hs-var">a</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779534"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-cpp">
#endif
</span><span class="annot"><a href="GHC.Utils.Misc.html#only"><span class="hs-identifier hs-var">only</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; a
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Util: only&quot;</span></span><span>
</span><span id="line-568"></span><span>
</span><span id="line-569"></span><span class="hs-comment">-- Debugging/specialising versions of \tr{elem} and \tr{notElem}</span><span class="hs-cpp">

# if !defined(DEBUG)
</span><span id="local-6989586621680780329"><span class="annot"><a href="GHC.Utils.Misc.html#isIn"><span class="hs-identifier hs-type">isIn</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#isn%27tIn"><span class="hs-identifier hs-type">isn'tIn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621680780329"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780329"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780329"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-573"></span><span id="isIn"><span class="annot"><span class="annottext">isIn :: forall a. Eq a =&gt; String -&gt; a -&gt; [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#isIn"><span class="hs-identifier hs-var hs-var">isIn</span></a></span></span><span>    </span><span id="local-6989586621680779529"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779529"><span class="hs-identifier hs-var">_msg</span></a></span></span><span> </span><span id="local-6989586621680779528"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779528"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621680779527"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779527"><span class="hs-identifier hs-var">ys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779528"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779527"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-574"></span><span id="isn%27tIn"><span class="annot"><span class="annottext">isn'tIn :: forall a. Eq a =&gt; String -&gt; a -&gt; [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#isn%27tIn"><span class="hs-identifier hs-var hs-var">isn'tIn</span></a></span></span><span> </span><span id="local-6989586621680779522"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779522"><span class="hs-identifier hs-var">_msg</span></a></span></span><span> </span><span id="local-6989586621680779521"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779521"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621680779520"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779520"><span class="hs-identifier hs-var">ys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779521"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#notElem"><span class="hs-operator hs-var">`notElem`</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779520"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-cpp">

# else /* DEBUG */
</span><span class="hs-identifier">isIn</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">isn'tIn</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">HasDebugCallStack</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">Eq</span><span> </span><span class="hs-identifier">a</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-identifier">a</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-578"></span><span class="hs-identifier">isIn</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-identifier">ys</span><span>
</span><span id="line-579"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">elem100</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-identifier">ys</span><span>
</span><span id="line-580"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-581"></span><span>    </span><span class="hs-identifier">elem100</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Eq</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-identifier">a</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-582"></span><span>    </span><span class="hs-identifier">elem100</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">False</span><span>
</span><span id="line-583"></span><span>    </span><span class="hs-identifier">elem100</span><span> </span><span class="hs-identifier">i</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">y</span><span class="hs-glyph">:</span><span class="hs-identifier">ys</span><span class="hs-special">)</span><span>
</span><span id="line-584"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">i</span><span> </span><span class="hs-operator">&gt;</span><span> </span><span class="hs-number">100</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">WARN</span><span class="hs-special">(</span><span class="hs-identifier">True</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">text</span><span> </span><span class="hs-special">(</span><span class="hs-string">&quot;Over-long elem in &quot;</span><span> </span><span class="hs-operator">++</span><span> </span><span class="hs-identifier">msg</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">x</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">elem</span><span class="hs-special">`</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">y</span><span class="hs-glyph">:</span><span class="hs-identifier">ys</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-585"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">otherwise</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">y</span><span> </span><span class="hs-operator">||</span><span> </span><span class="hs-identifier">elem100</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">i</span><span> </span><span class="hs-operator">+</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-identifier">ys</span><span>
</span><span id="line-586"></span><span>
</span><span id="line-587"></span><span class="hs-identifier">isn'tIn</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-identifier">ys</span><span>
</span><span id="line-588"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">notElem100</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-identifier">ys</span><span>
</span><span id="line-589"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-590"></span><span>    </span><span class="hs-identifier">notElem100</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Eq</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-identifier">a</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-591"></span><span>    </span><span class="hs-identifier">notElem100</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">True</span><span>
</span><span id="line-592"></span><span>    </span><span class="hs-identifier">notElem100</span><span> </span><span class="hs-identifier">i</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">y</span><span class="hs-glyph">:</span><span class="hs-identifier">ys</span><span class="hs-special">)</span><span>
</span><span id="line-593"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">i</span><span> </span><span class="hs-operator">&gt;</span><span> </span><span class="hs-number">100</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">WARN</span><span class="hs-special">(</span><span class="hs-identifier">True</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">text</span><span> </span><span class="hs-special">(</span><span class="hs-string">&quot;Over-long notElem in &quot;</span><span> </span><span class="hs-operator">++</span><span> </span><span class="hs-identifier">msg</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">x</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">notElem</span><span class="hs-special">`</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">y</span><span class="hs-glyph">:</span><span class="hs-identifier">ys</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-594"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">otherwise</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-operator">/=</span><span> </span><span class="hs-identifier">y</span><span> </span><span class="hs-operator">&amp;&amp;</span><span> </span><span class="hs-identifier">notElem100</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">i</span><span> </span><span class="hs-operator">+</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-identifier">ys</span><span class="hs-cpp">
# endif /* DEBUG */
</span><span>
</span><span id="line-597"></span><span>
</span><span id="line-598"></span><span class="hs-comment">-- | Split a list into chunks of /n/ elements</span><span>
</span><span id="line-599"></span><span id="local-6989586621680780323"><span class="annot"><a href="GHC.Utils.Misc.html#chunkList"><span class="hs-identifier hs-type">chunkList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780323"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780323"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span></span><span>
</span><span id="line-600"></span><span id="chunkList"><span class="annot"><span class="annottext">chunkList :: forall a. Int -&gt; [a] -&gt; [[a]]
</span><a href="GHC.Utils.Misc.html#chunkList"><span class="hs-identifier hs-var hs-var">chunkList</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-601"></span><span class="annot"><a href="GHC.Utils.Misc.html#chunkList"><span class="hs-identifier hs-var">chunkList</span></a></span><span> </span><span id="local-6989586621680779518"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779518"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680779517"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779517"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779516"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [[a]] -&gt; [[a]]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; [a] -&gt; [[a]]
forall a. Int -&gt; [a] -&gt; [[a]]
</span><a href="GHC.Utils.Misc.html#chunkList"><span class="hs-identifier hs-var">chunkList</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779518"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779515"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779516"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779516"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680779515"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779515"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [a] -&gt; ([a], [a])
forall a. Int -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#splitAt"><span class="hs-identifier hs-var">splitAt</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779518"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779517"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-602"></span><span>
</span><span id="line-603"></span><span class="hs-comment">-- | Replace the last element of a list with another element.</span><span>
</span><span id="line-604"></span><span id="local-6989586621680780320"><span class="annot"><a href="GHC.Utils.Misc.html#changeLast"><span class="hs-identifier hs-type">changeLast</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780320"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780320"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780320"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-605"></span><span id="changeLast"><span class="annot"><span class="annottext">changeLast :: forall a. [a] -&gt; a -&gt; [a]
</span><a href="GHC.Utils.Misc.html#changeLast"><span class="hs-identifier hs-var hs-var">changeLast</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [a]
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;changeLast&quot;</span></span><span>
</span><span id="line-606"></span><span class="annot"><a href="GHC.Utils.Misc.html#changeLast"><span class="hs-identifier hs-var">changeLast</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">]</span><span>    </span><span id="local-6989586621680779513"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779513"><span class="hs-identifier hs-var">x</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779513"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-607"></span><span class="annot"><a href="GHC.Utils.Misc.html#changeLast"><span class="hs-identifier hs-var">changeLast</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779512"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779512"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779511"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779511"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680779510"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779510"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779512"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; a -&gt; [a]
forall a. [a] -&gt; a -&gt; [a]
</span><a href="GHC.Utils.Misc.html#changeLast"><span class="hs-identifier hs-var">changeLast</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779511"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779510"><span class="hs-identifier hs-var">x'</span></a></span><span>
</span><span id="line-608"></span><span>
</span><span id="line-609"></span><span class="hs-comment">-- | Apply an effectful function to the last list element.</span><span>
</span><span id="line-610"></span><span class="hs-comment">-- Assumes a non-empty list (panics otherwise).</span><span>
</span><span id="line-611"></span><span id="local-6989586621680780317"><span id="local-6989586621680780318"><span class="annot"><a href="GHC.Utils.Misc.html#mapLastM"><span class="hs-identifier hs-type">mapLastM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780318"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780317"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780318"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780317"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780317"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780318"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780317"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-612"></span><span id="mapLastM"><span class="annot"><span class="annottext">mapLastM :: forall (f :: * -&gt; *) a. Functor f =&gt; (a -&gt; f a) -&gt; [a] -&gt; f [a]
</span><a href="GHC.Utils.Misc.html#mapLastM"><span class="hs-identifier hs-var hs-var">mapLastM</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; f a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; f [a]
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mapLastM: empty list&quot;</span></span><span>
</span><span id="line-613"></span><span class="annot"><a href="GHC.Utils.Misc.html#mapLastM"><span class="hs-identifier hs-var">mapLastM</span></a></span><span> </span><span id="local-6989586621680779505"><span class="annot"><span class="annottext">a -&gt; f a
</span><a href="#local-6989586621680779505"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">[</span><span id="local-6989586621680779504"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779504"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680779503"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779503"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779503"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(a -&gt; [a]) -&gt; f a -&gt; f [a]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; f a
</span><a href="#local-6989586621680779505"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779504"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-614"></span><span class="annot"><a href="GHC.Utils.Misc.html#mapLastM"><span class="hs-identifier hs-var">mapLastM</span></a></span><span> </span><span id="local-6989586621680779502"><span class="annot"><span class="annottext">a -&gt; f a
</span><a href="#local-6989586621680779502"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779501"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779501"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779500"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779500"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779501"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([a] -&gt; [a]) -&gt; f [a] -&gt; f [a]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; f a) -&gt; [a] -&gt; f [a]
forall (f :: * -&gt; *) a. Functor f =&gt; (a -&gt; f a) -&gt; [a] -&gt; f [a]
</span><a href="GHC.Utils.Misc.html#mapLastM"><span class="hs-identifier hs-var">mapLastM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; f a
</span><a href="#local-6989586621680779502"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779500"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-615"></span><span>
</span><span id="line-616"></span><span id="local-6989586621680780313"><span id="local-6989586621680780314"><span class="annot"><a href="GHC.Utils.Misc.html#whenNonEmpty"><span class="hs-identifier hs-type">whenNonEmpty</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780314"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780313"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#NonEmpty"><span class="hs-identifier hs-type">NonEmpty</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780313"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780314"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780314"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span></span><span>
</span><span id="line-617"></span><span id="whenNonEmpty"><span class="annot"><span class="annottext">whenNonEmpty :: forall (m :: * -&gt; *) a.
Applicative m =&gt;
[a] -&gt; (NonEmpty a -&gt; m ()) -&gt; m ()
</span><a href="GHC.Utils.Misc.html#whenNonEmpty"><span class="hs-identifier hs-var hs-var">whenNonEmpty</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="annot"><span class="annottext">NonEmpty a -&gt; m ()
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; m ()
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-618"></span><span class="annot"><a href="GHC.Utils.Misc.html#whenNonEmpty"><span class="hs-identifier hs-var">whenNonEmpty</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779497"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779497"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779496"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779496"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680779495"><span class="annot"><span class="annottext">NonEmpty a -&gt; m ()
</span><a href="#local-6989586621680779495"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NonEmpty a -&gt; m ()
</span><a href="#local-6989586621680779495"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779497"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; NonEmpty a
forall a. a -&gt; [a] -&gt; NonEmpty a
</span><a href="../../base/src/GHC.Base.html#%3A%7C"><span class="hs-operator hs-var">:|</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779496"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-619"></span><span>
</span><span id="line-620"></span><span class="hs-comment">-- | Merge an unsorted list of sorted lists, for example:</span><span>
</span><span id="line-621"></span><span class="hs-comment">--</span><span>
</span><span id="line-622"></span><span class="hs-comment">--  &gt; mergeListsBy compare [ [2,5,15], [1,10,100] ] = [1,2,5,10,15,100]</span><span>
</span><span id="line-623"></span><span class="hs-comment">--</span><span>
</span><span id="line-624"></span><span class="hs-comment">--  \( O(n \log{} k) \)</span><span>
</span><span id="line-625"></span><span class="annot"><a href="GHC.Utils.Misc.html#mergeListsBy"><span class="hs-identifier hs-type">mergeListsBy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621680780307"><span class="annot"><a href="#local-6989586621680780307"><span class="hs-identifier hs-type">a</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780307"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780307"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ordering</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780307"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780307"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-626"></span><span id="mergeListsBy"><span class="annot"><span class="annottext">mergeListsBy :: forall a. (a -&gt; a -&gt; Ordering) -&gt; [[a]] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#mergeListsBy"><span class="hs-identifier hs-var hs-var">mergeListsBy</span></a></span></span><span> </span><span id="local-6989586621680779492"><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
</span><a href="#local-6989586621680779492"><span class="hs-identifier hs-var">cmp</span></a></span></span><span> </span><span id="local-6989586621680779491"><span class="annot"><span class="annottext">[[a]]
</span><a href="#local-6989586621680779491"><span class="hs-identifier hs-var">lists</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Utils.Misc.html#debugIsOn"><span class="hs-identifier hs-var">debugIsOn</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">([a] -&gt; Bool) -&gt; [[a]] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Bool
</span><a href="#local-6989586621680779488"><span class="hs-identifier hs-var">sorted</span></a></span><span> </span><span class="annot"><span class="annottext">[[a]]
</span><a href="#local-6989586621680779491"><span class="hs-identifier hs-var">lists</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-627"></span><span>  </span><span class="hs-comment">-- When debugging is on, we check that the input lists are sorted.</span><span>
</span><span id="line-628"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; [a]
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mergeListsBy: input lists must be sorted&quot;</span></span><span>
</span><span id="line-629"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680779488"><span class="annot"><span class="annottext">sorted :: [a] -&gt; Bool
</span><a href="#local-6989586621680779488"><span class="hs-identifier hs-var hs-var">sorted</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; Ordering) -&gt; [a] -&gt; Bool
forall a. (a -&gt; a -&gt; Ordering) -&gt; [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#isSortedBy"><span class="hs-identifier hs-var">isSortedBy</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
</span><a href="#local-6989586621680779492"><span class="hs-identifier hs-var">cmp</span></a></span><span>
</span><span id="line-630"></span><span class="annot"><a href="GHC.Utils.Misc.html#mergeListsBy"><span class="hs-identifier hs-var">mergeListsBy</span></a></span><span> </span><span id="local-6989586621680779487"><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
</span><a href="#local-6989586621680779487"><span class="hs-identifier hs-var">cmp</span></a></span></span><span> </span><span id="local-6989586621680779486"><span class="annot"><span class="annottext">[[a]]
</span><a href="#local-6989586621680779486"><span class="hs-identifier hs-var">all_lists</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[[a]] -&gt; [a]
</span><a href="#local-6989586621680779485"><span class="hs-identifier hs-var">merge_lists</span></a></span><span> </span><span class="annot"><span class="annottext">[[a]]
</span><a href="#local-6989586621680779486"><span class="hs-identifier hs-var">all_lists</span></a></span><span>
</span><span id="line-631"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-632"></span><span>    </span><span class="hs-comment">-- Implements &quot;Iterative 2-Way merge&quot; described at</span><span>
</span><span id="line-633"></span><span>    </span><span class="hs-comment">-- https://en.wikipedia.org/wiki/K-way_merge_algorithm</span><span>
</span><span id="line-634"></span><span>
</span><span id="line-635"></span><span>    </span><span class="hs-comment">-- Merge two sorted lists into one in O(n).</span><span>
</span><span id="line-636"></span><span>    </span><span class="annot"><a href="#local-6989586621680779484"><span class="hs-identifier hs-type">merge2</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780307"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780307"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780307"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-637"></span><span>    </span><span id="local-6989586621680779484"><span class="annot"><span class="annottext">merge2 :: [a] -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621680779484"><span class="hs-identifier hs-var hs-var">merge2</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621680779483"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779483"><span class="hs-identifier hs-var">ys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779483"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-638"></span><span>    </span><span class="annot"><a href="#local-6989586621680779484"><span class="hs-identifier hs-var">merge2</span></a></span><span> </span><span id="local-6989586621680779482"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779482"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779482"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-639"></span><span>    </span><span class="annot"><a href="#local-6989586621680779484"><span class="hs-identifier hs-var">merge2</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779481"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779481"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779480"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779480"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779479"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779479"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779478"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779478"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-640"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
</span><a href="#local-6989586621680779487"><span class="hs-identifier hs-var">cmp</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779481"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779479"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-641"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779479"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621680779484"><span class="hs-identifier hs-var">merge2</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779481"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779480"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779478"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-642"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779481"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621680779484"><span class="hs-identifier hs-var">merge2</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779480"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779479"><span class="hs-identifier hs-var">y</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779478"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-643"></span><span>
</span><span id="line-644"></span><span>    </span><span class="hs-comment">-- Merge the first list with the second, the third with the fourth, and so</span><span>
</span><span id="line-645"></span><span>    </span><span class="hs-comment">-- on. The output has half as much lists as the input.</span><span>
</span><span id="line-646"></span><span>    </span><span class="annot"><a href="#local-6989586621680779477"><span class="hs-identifier hs-type">merge_neighbours</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780307"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780307"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span>
</span><span id="line-647"></span><span>    </span><span id="local-6989586621680779477"><span class="annot"><span class="annottext">merge_neighbours :: [[a]] -&gt; [[a]]
</span><a href="#local-6989586621680779477"><span class="hs-identifier hs-var hs-var">merge_neighbours</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-648"></span><span>    </span><span class="annot"><a href="#local-6989586621680779477"><span class="hs-identifier hs-var">merge_neighbours</span></a></span><span> </span><span class="hs-special">[</span><span id="local-6989586621680779476"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779476"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779476"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-649"></span><span>    </span><span class="annot"><a href="#local-6989586621680779477"><span class="hs-identifier hs-var">merge_neighbours</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779475"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779475"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680779474"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779474"><span class="hs-identifier hs-var">ys</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680779473"><span class="annot"><span class="annottext">[[a]]
</span><a href="#local-6989586621680779473"><span class="hs-identifier hs-var">lists</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-650"></span><span>      </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621680779484"><span class="hs-identifier hs-var">merge2</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779475"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779474"><span class="hs-identifier hs-var">ys</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [[a]] -&gt; [[a]]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[[a]] -&gt; [[a]]
</span><a href="#local-6989586621680779477"><span class="hs-identifier hs-var">merge_neighbours</span></a></span><span> </span><span class="annot"><span class="annottext">[[a]]
</span><a href="#local-6989586621680779473"><span class="hs-identifier hs-var">lists</span></a></span><span>
</span><span id="line-651"></span><span>
</span><span id="line-652"></span><span>    </span><span class="hs-comment">-- Since 'merge_neighbours' halves the amount of lists in each iteration,</span><span>
</span><span id="line-653"></span><span>    </span><span class="hs-comment">-- we perform O(log k) iteration. Each iteration is O(n). The total running</span><span>
</span><span id="line-654"></span><span>    </span><span class="hs-comment">-- time is therefore O(n log k).</span><span>
</span><span id="line-655"></span><span>    </span><span class="annot"><a href="#local-6989586621680779485"><span class="hs-identifier hs-type">merge_lists</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780307"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780307"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-656"></span><span>    </span><span id="local-6989586621680779485"><span class="annot"><span class="annottext">merge_lists :: [[a]] -&gt; [a]
</span><a href="#local-6989586621680779485"><span class="hs-identifier hs-var hs-var">merge_lists</span></a></span></span><span> </span><span id="local-6989586621680779472"><span class="annot"><span class="annottext">[[a]]
</span><a href="#local-6989586621680779472"><span class="hs-identifier hs-var">lists</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-657"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[[a]] -&gt; [[a]]
</span><a href="#local-6989586621680779477"><span class="hs-identifier hs-var">merge_neighbours</span></a></span><span> </span><span class="annot"><span class="annottext">[[a]]
</span><a href="#local-6989586621680779472"><span class="hs-identifier hs-var">lists</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-658"></span><span>        </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-659"></span><span>        </span><span class="hs-special">[</span><span id="local-6989586621680779471"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779471"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">]</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779471"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-660"></span><span>        </span><span id="local-6989586621680779470"><span class="annot"><span class="annottext">[[a]]
</span><a href="#local-6989586621680779470"><span class="hs-identifier hs-var">lists'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[[a]] -&gt; [a]
</span><a href="#local-6989586621680779485"><span class="hs-identifier hs-var">merge_lists</span></a></span><span> </span><span class="annot"><span class="annottext">[[a]]
</span><a href="#local-6989586621680779470"><span class="hs-identifier hs-var">lists'</span></a></span><span>
</span><span id="line-661"></span><span>
</span><span id="line-662"></span><span id="local-6989586621680780303"><span class="annot"><a href="GHC.Utils.Misc.html#isSortedBy"><span class="hs-identifier hs-type">isSortedBy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780303"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780303"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ordering</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780303"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-663"></span><span id="isSortedBy"><span class="annot"><span class="annottext">isSortedBy :: forall a. (a -&gt; a -&gt; Ordering) -&gt; [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#isSortedBy"><span class="hs-identifier hs-var hs-var">isSortedBy</span></a></span></span><span> </span><span id="local-6989586621680779469"><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
</span><a href="#local-6989586621680779469"><span class="hs-identifier hs-var">cmp</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Bool
</span><a href="#local-6989586621680779468"><span class="hs-identifier hs-var">sorted</span></a></span><span>
</span><span id="line-664"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-665"></span><span>    </span><span id="local-6989586621680779468"><span class="annot"><span class="annottext">sorted :: [a] -&gt; Bool
</span><a href="#local-6989586621680779468"><span class="hs-identifier hs-var hs-var">sorted</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-666"></span><span>    </span><span class="annot"><a href="#local-6989586621680779468"><span class="hs-identifier hs-var">sorted</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-667"></span><span>    </span><span class="annot"><a href="#local-6989586621680779468"><span class="hs-identifier hs-var">sorted</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779465"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779465"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779464"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779464"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779463"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779463"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
</span><a href="#local-6989586621680779469"><span class="hs-identifier hs-var">cmp</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779465"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779464"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Ordering -&gt; Ordering -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Bool
</span><a href="#local-6989586621680779468"><span class="hs-identifier hs-var">sorted</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779464"><span class="hs-identifier hs-var">y</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779463"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-668"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsubsection{Sort utils}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-675"></span><span>
</span><span id="line-676"></span><span id="local-6989586621680780299"><span id="local-6989586621680780300"><span class="annot"><a href="GHC.Utils.Misc.html#minWith"><span class="hs-identifier hs-type">minWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621680780300"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780299"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780300"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780299"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780299"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-677"></span><span id="minWith"><span class="annot"><span class="annottext">minWith :: forall b a. Ord b =&gt; (a -&gt; b) -&gt; [a] -&gt; a
</span><a href="GHC.Utils.Misc.html#minWith"><span class="hs-identifier hs-var hs-var">minWith</span></a></span></span><span> </span><span id="local-6989586621680779457"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680779457"><span class="hs-identifier hs-var">get_key</span></a></span></span><span> </span><span id="local-6989586621680779456"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779456"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">not</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">null</span><span> </span><span class="hs-identifier">xs</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-678"></span><span>                     </span><span class="annot"><span class="annottext">[a] -&gt; a
forall a. [a] -&gt; a
</span><a href="../../base/src/GHC.List.html#head"><span class="hs-identifier hs-var">head</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; [a] -&gt; [a]
forall b a. Ord b =&gt; (a -&gt; b) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Exts.html#sortWith"><span class="hs-identifier hs-var">sortWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680779457"><span class="hs-identifier hs-var">get_key</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779456"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-679"></span><span>
</span><span id="line-680"></span><span id="local-6989586621680780293"><span class="annot"><a href="GHC.Utils.Misc.html#nubSort"><span class="hs-identifier hs-type">nubSort</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621680780293"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780293"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780293"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-681"></span><span id="nubSort"><span class="annot"><span class="annottext">nubSort :: forall a. Ord a =&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#nubSort"><span class="hs-identifier hs-var hs-var">nubSort</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a]
forall a. Set a -&gt; [a]
</span><a href="../../containers/src/Data.Set.Internal.html#toAscList"><span class="hs-identifier hs-var">Set.toAscList</span></a></span><span> </span><span class="annot"><span class="annottext">(Set a -&gt; [a]) -&gt; ([a] -&gt; Set a) -&gt; [a] -&gt; [a]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Set a
forall a. Ord a =&gt; [a] -&gt; Set a
</span><a href="../../containers/src/Data.Set.Internal.html#fromList"><span class="hs-identifier hs-var">Set.fromList</span></a></span><span>
</span><span id="line-682"></span><span>
</span><span id="line-683"></span><span class="hs-comment">-- | Remove duplicates but keep elements in order.</span><span>
</span><span id="line-684"></span><span class="hs-comment">--   O(n * log n)</span><span>
</span><span id="line-685"></span><span id="local-6989586621680779449"><span class="annot"><a href="GHC.Utils.Misc.html#ordNub"><span class="hs-identifier hs-type">ordNub</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621680779449"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779449"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779449"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-686"></span><span id="ordNub"><span class="annot"><span class="annottext">ordNub :: forall a. Ord a =&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#ordNub"><span class="hs-identifier hs-var hs-var">ordNub</span></a></span></span><span> </span><span id="local-6989586621680779446"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779446"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-687"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a] -&gt; [a]
forall {a}. Ord a =&gt; Set a -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621680779445"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="../../containers/src/Data.Set.Internal.html#empty"><span class="hs-identifier hs-var">Set.empty</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779446"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-688"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-689"></span><span>    </span><span id="local-6989586621680779445"><span class="annot"><span class="annottext">go :: Set a -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621680779445"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-690"></span><span>    </span><span class="annot"><a href="#local-6989586621680779445"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680779440"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621680779440"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779439"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779439"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779438"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779438"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-691"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Bool
forall a. Ord a =&gt; a -&gt; Set a -&gt; Bool
</span><a href="../../containers/src/Data.Set.Internal.html#member"><span class="hs-identifier hs-var">Set.member</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779439"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621680779440"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621680779445"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621680779440"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779438"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-692"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779439"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621680779445"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; a -&gt; Set a -&gt; Set a
</span><a href="../../containers/src/Data.Set.Internal.html#insert"><span class="hs-identifier hs-var">Set.insert</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779439"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621680779440"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779438"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-693"></span><span>
</span><span id="line-694"></span><span>
</span><span id="line-695"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection[Utils-transitive-closure]{Transitive closure}
*                                                                      *
************************************************************************

This algorithm for transitive closure is straightforward, albeit quadratic.
-}</span><span>
</span><span id="line-704"></span><span>
</span><span id="line-705"></span><span id="local-6989586621680780283"><span class="annot"><a href="GHC.Utils.Misc.html#transitiveClosure"><span class="hs-identifier hs-type">transitiveClosure</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780283"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780283"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>         </span><span class="hs-comment">-- Successor function</span><span>
</span><span id="line-706"></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780283"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780283"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span>   </span><span class="hs-comment">-- Equality predicate</span><span>
</span><span id="line-707"></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780283"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-708"></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780283"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>                </span><span class="hs-comment">-- The transitive closure</span><span>
</span><span id="line-709"></span><span>
</span><span id="line-710"></span><span id="transitiveClosure"><span class="annot"><span class="annottext">transitiveClosure :: forall a. (a -&gt; [a]) -&gt; (a -&gt; a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#transitiveClosure"><span class="hs-identifier hs-var hs-var">transitiveClosure</span></a></span></span><span> </span><span id="local-6989586621680779435"><span class="annot"><span class="annottext">a -&gt; [a]
</span><a href="#local-6989586621680779435"><span class="hs-identifier hs-var">succ</span></a></span></span><span> </span><span id="local-6989586621680779434"><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
</span><a href="#local-6989586621680779434"><span class="hs-identifier hs-var">eq</span></a></span></span><span> </span><span id="local-6989586621680779433"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779433"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-711"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621680779432"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779433"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-712"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-713"></span><span>   </span><span id="local-6989586621680779432"><span class="annot"><span class="annottext">go :: [a] -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621680779432"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621680779431"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779431"><span class="hs-identifier hs-var">done</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779431"><span class="hs-identifier hs-var">done</span></a></span><span>
</span><span id="line-714"></span><span>   </span><span class="annot"><a href="#local-6989586621680779432"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680779430"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779430"><span class="hs-identifier hs-var">done</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779429"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779429"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779428"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779428"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779429"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; Bool
</span><a href="#local-6989586621680779427"><span class="hs-operator hs-var">`is_in`</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779430"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621680779432"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779430"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779428"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-715"></span><span>                  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621680779432"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779429"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779430"><span class="hs-identifier hs-var">done</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; [a]
</span><a href="#local-6989586621680779435"><span class="hs-identifier hs-var">succ</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779429"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779428"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-716"></span><span>
</span><span id="line-717"></span><span>   </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680779427"><span class="annot"><span class="annottext">is_in :: a -&gt; [a] -&gt; Bool
</span><a href="#local-6989586621680779427"><span class="hs-operator hs-var hs-var">`is_in`</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-718"></span><span>   </span><span id="local-6989586621680779426"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779426"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="#local-6989586621680779427"><span class="hs-operator hs-var">`is_in`</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779425"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779425"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779424"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779424"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
</span><a href="#local-6989586621680779434"><span class="hs-identifier hs-var">eq</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779426"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779425"><span class="hs-identifier hs-var">y</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-719"></span><span>                    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779426"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; Bool
</span><a href="#local-6989586621680779427"><span class="hs-operator hs-var">`is_in`</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779424"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-720"></span><span>
</span><span id="line-721"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection[Utils-accum]{Accumulating}
*                                                                      *
************************************************************************

A combination of foldl with zip.  It works with equal length lists.
-}</span><span>
</span><span id="line-730"></span><span>
</span><span id="line-731"></span><span id="local-6989586621680780279"><span id="local-6989586621680780280"><span id="local-6989586621680780281"><span class="annot"><a href="GHC.Utils.Misc.html#foldl2"><span class="hs-identifier hs-type">foldl2</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780281"><span class="hs-identifier hs-type">acc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780280"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780279"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780281"><span class="hs-identifier hs-type">acc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780281"><span class="hs-identifier hs-type">acc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780280"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780279"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780281"><span class="hs-identifier hs-type">acc</span></a></span></span></span></span><span>
</span><span id="line-732"></span><span id="foldl2"><span class="annot"><span class="annottext">foldl2 :: forall acc a b. (acc -&gt; a -&gt; b -&gt; acc) -&gt; acc -&gt; [a] -&gt; [b] -&gt; acc
</span><a href="GHC.Utils.Misc.html#foldl2"><span class="hs-identifier hs-var hs-var">foldl2</span></a></span></span><span> </span><span class="annot"><span class="annottext">acc -&gt; a -&gt; b -&gt; acc
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680779423"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680779423"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680779423"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-733"></span><span class="annot"><a href="GHC.Utils.Misc.html#foldl2"><span class="hs-identifier hs-var">foldl2</span></a></span><span> </span><span id="local-6989586621680779422"><span class="annot"><span class="annottext">acc -&gt; a -&gt; b -&gt; acc
</span><a href="#local-6989586621680779422"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680779421"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680779421"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779420"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779420"><span class="hs-identifier hs-var">a</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779419"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779419"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779418"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779418"><span class="hs-identifier hs-var">b</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779417"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779417"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(acc -&gt; a -&gt; b -&gt; acc) -&gt; acc -&gt; [a] -&gt; [b] -&gt; acc
forall acc a b. (acc -&gt; a -&gt; b -&gt; acc) -&gt; acc -&gt; [a] -&gt; [b] -&gt; acc
</span><a href="GHC.Utils.Misc.html#foldl2"><span class="hs-identifier hs-var">foldl2</span></a></span><span> </span><span class="annot"><span class="annottext">acc -&gt; a -&gt; b -&gt; acc
</span><a href="#local-6989586621680779422"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">acc -&gt; a -&gt; b -&gt; acc
</span><a href="#local-6989586621680779422"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680779421"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779420"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779418"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779419"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779417"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-734"></span><span class="annot"><a href="GHC.Utils.Misc.html#foldl2"><span class="hs-identifier hs-var">foldl2</span></a></span><span> </span><span class="annot"><span class="annottext">acc -&gt; a -&gt; b -&gt; acc
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">acc
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; acc
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Util: foldl2&quot;</span></span><span>
</span><span id="line-735"></span><span>
</span><span id="line-736"></span><span id="local-6989586621680780274"><span id="local-6989586621680780275"><span class="annot"><a href="GHC.Utils.Misc.html#all2"><span class="hs-identifier hs-type">all2</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780275"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780274"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780275"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780274"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span></span><span>
</span><span id="line-737"></span><span class="hs-comment">-- True if the lists are the same length, and</span><span>
</span><span id="line-738"></span><span class="hs-comment">-- all corresponding elements satisfy the predicate</span><span>
</span><span id="line-739"></span><span id="all2"><span class="annot"><span class="annottext">all2 :: forall a b. (a -&gt; b -&gt; Bool) -&gt; [a] -&gt; [b] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#all2"><span class="hs-identifier hs-var hs-var">all2</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-740"></span><span class="annot"><a href="GHC.Utils.Misc.html#all2"><span class="hs-identifier hs-var">all2</span></a></span><span> </span><span id="local-6989586621680779416"><span class="annot"><span class="annottext">a -&gt; b -&gt; Bool
</span><a href="#local-6989586621680779416"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779415"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779415"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779414"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779414"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779413"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779413"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779412"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779412"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; Bool
</span><a href="#local-6989586621680779416"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779415"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779413"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; Bool) -&gt; [a] -&gt; [b] -&gt; Bool
forall a b. (a -&gt; b -&gt; Bool) -&gt; [a] -&gt; [b] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#all2"><span class="hs-identifier hs-var">all2</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; Bool
</span><a href="#local-6989586621680779416"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779414"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779412"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-741"></span><span class="annot"><a href="GHC.Utils.Misc.html#all2"><span class="hs-identifier hs-var">all2</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-742"></span><span>
</span><span id="line-743"></span><span class="hs-comment">-- Count the number of times a predicate is true</span><span>
</span><span id="line-744"></span><span>
</span><span id="line-745"></span><span id="local-6989586621680780271"><span class="annot"><a href="GHC.Utils.Misc.html#count"><span class="hs-identifier hs-type">count</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780271"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780271"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span></span><span>
</span><span id="line-746"></span><span id="count"><span class="annot"><span class="annottext">count :: forall a. (a -&gt; Bool) -&gt; [a] -&gt; Int
</span><a href="GHC.Utils.Misc.html#count"><span class="hs-identifier hs-var hs-var">count</span></a></span></span><span> </span><span id="local-6989586621680779409"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779409"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [a] -&gt; Int
forall {t}. Num t =&gt; t -&gt; [a] -&gt; t
</span><a href="#local-6989586621680779408"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-747"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680779408"><span class="annot"><span class="annottext">go :: t -&gt; [a] -&gt; t
</span><a href="#local-6989586621680779408"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621680779404"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680779404"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680779404"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-748"></span><span>        </span><span class="annot"><a href="#local-6989586621680779408"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621680779403"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680779403"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779402"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779402"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779401"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779401"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779409"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779402"><span class="hs-identifier hs-var">x</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; [a] -&gt; t
</span><a href="#local-6989586621680779408"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680779403"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">t -&gt; t -&gt; t
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">t
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779401"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-749"></span><span>                     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; [a] -&gt; t
</span><a href="#local-6989586621680779408"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680779403"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779401"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-750"></span><span>
</span><span id="line-751"></span><span id="local-6989586621680779399"><span class="annot"><a href="GHC.Utils.Misc.html#countWhile"><span class="hs-identifier hs-type">countWhile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680779399"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779399"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span></span><span>
</span><span id="line-752"></span><span class="hs-comment">-- Length of an /initial prefix/ of the list satisfying p</span><span>
</span><span id="line-753"></span><span id="countWhile"><span class="annot"><span class="annottext">countWhile :: forall a. (a -&gt; Bool) -&gt; [a] -&gt; Int
</span><a href="GHC.Utils.Misc.html#countWhile"><span class="hs-identifier hs-var hs-var">countWhile</span></a></span></span><span> </span><span id="local-6989586621680779396"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779396"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [a] -&gt; Int
forall {t}. Num t =&gt; t -&gt; [a] -&gt; t
</span><a href="#local-6989586621680779395"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-754"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680779395"><span class="annot"><span class="annottext">go :: t -&gt; [a] -&gt; t
</span><a href="#local-6989586621680779395"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621680779391"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680779391"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779390"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779390"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779389"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779389"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779396"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779390"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; [a] -&gt; t
</span><a href="#local-6989586621680779395"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680779391"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">t -&gt; t -&gt; t
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">t
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779389"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-755"></span><span>        </span><span class="annot"><a href="#local-6989586621680779395"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621680779388"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680779388"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680779388"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-756"></span><span>
</span><span id="line-757"></span><span class="hs-comment">{-
@splitAt@, @take@, and @drop@ but with length of another
list giving the break-off point:
-}</span><span>
</span><span id="line-761"></span><span>
</span><span id="line-762"></span><span id="local-6989586621680780265"><span id="local-6989586621680780266"><span class="annot"><a href="GHC.Utils.Misc.html#takeList"><span class="hs-identifier hs-type">takeList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780266"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780265"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780265"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-763"></span><span class="hs-comment">-- (takeList as bs) trims bs to the be same length</span><span>
</span><span id="line-764"></span><span class="hs-comment">-- as as, unless as is longer in which case it's a no-op</span><span>
</span><span id="line-765"></span><span id="takeList"><span class="annot"><span class="annottext">takeList :: forall b a. [b] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#takeList"><span class="hs-identifier hs-var hs-var">takeList</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-766"></span><span class="annot"><a href="GHC.Utils.Misc.html#takeList"><span class="hs-identifier hs-var">takeList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779387"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779387"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680779386"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779386"><span class="hs-identifier hs-var">ls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-767"></span><span>   </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779386"><span class="hs-identifier hs-var">ls</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-768"></span><span>     </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-769"></span><span>     </span><span class="hs-special">(</span><span id="local-6989586621680779385"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779385"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779384"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779384"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779385"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[b] -&gt; [a] -&gt; [a]
forall b a. [b] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#takeList"><span class="hs-identifier hs-var">takeList</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779387"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779384"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-770"></span><span>
</span><span id="line-771"></span><span id="local-6989586621680779382"><span id="local-6989586621680779383"><span class="annot"><a href="GHC.Utils.Misc.html#dropList"><span class="hs-identifier hs-type">dropList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779383"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779382"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779382"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-772"></span><span id="dropList"><span class="annot"><span class="annottext">dropList :: forall b a. [b] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#dropList"><span class="hs-identifier hs-var hs-var">dropList</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621680779381"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779381"><span class="hs-identifier hs-var">xs</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779381"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-773"></span><span class="annot"><a href="GHC.Utils.Misc.html#dropList"><span class="hs-identifier hs-var">dropList</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span>  </span><span id="local-6989586621680779380"><span class="annot"><span class="annottext">xs :: [a]
</span><a href="#local-6989586621680779380"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779380"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-774"></span><span class="annot"><a href="GHC.Utils.Misc.html#dropList"><span class="hs-identifier hs-var">dropList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779379"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779379"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779378"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779378"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[b] -&gt; [a] -&gt; [a]
forall b a. [b] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#dropList"><span class="hs-identifier hs-var">dropList</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779379"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779378"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-775"></span><span>
</span><span id="line-776"></span><span>
</span><span id="line-777"></span><span id="local-6989586621680780259"><span id="local-6989586621680780260"><span class="annot"><a href="GHC.Utils.Misc.html#splitAtList"><span class="hs-identifier hs-type">splitAtList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780260"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780259"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780259"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780259"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span></span><span>
</span><span id="line-778"></span><span id="splitAtList"><span class="annot"><span class="annottext">splitAtList :: forall b a. [b] -&gt; [a] -&gt; ([a], [a])
</span><a href="GHC.Utils.Misc.html#splitAtList"><span class="hs-identifier hs-var hs-var">splitAtList</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621680779377"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779377"><span class="hs-identifier hs-var">xs</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779377"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-779"></span><span class="annot"><a href="GHC.Utils.Misc.html#splitAtList"><span class="hs-identifier hs-var">splitAtList</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680779376"><span class="annot"><span class="annottext">xs :: [a]
</span><a href="#local-6989586621680779376"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">[</span><span class="hs-special">]</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779376"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779376"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-780"></span><span class="annot"><a href="GHC.Utils.Misc.html#splitAtList"><span class="hs-identifier hs-var">splitAtList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779375"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779375"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779374"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779374"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779373"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779373"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779374"><span class="hs-identifier hs-var">y</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779372"><span class="hs-identifier hs-var">ys'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779371"><span class="hs-identifier hs-var">ys''</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-781"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-782"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621680779372"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779372"><span class="hs-identifier hs-var">ys'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779371"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779371"><span class="hs-identifier hs-var">ys''</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[b] -&gt; [a] -&gt; ([a], [a])
forall b a. [b] -&gt; [a] -&gt; ([a], [a])
</span><a href="GHC.Utils.Misc.html#splitAtList"><span class="hs-identifier hs-var">splitAtList</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779375"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779373"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-783"></span><span>
</span><span id="line-784"></span><span class="hs-comment">-- drop from the end of a list</span><span>
</span><span id="line-785"></span><span id="local-6989586621680780256"><span class="annot"><a href="GHC.Utils.Misc.html#dropTail"><span class="hs-identifier hs-type">dropTail</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780256"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780256"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-786"></span><span class="hs-comment">-- Specification: dropTail n = reverse . drop n . reverse</span><span>
</span><span id="line-787"></span><span class="hs-comment">-- Better implemention due to Joachim Breitner</span><span>
</span><span id="line-788"></span><span class="hs-comment">-- http://www.joachim-breitner.de/blog/archives/600-On-taking-the-last-n-elements-of-a-list.html</span><span>
</span><span id="line-789"></span><span id="dropTail"><span class="annot"><span class="annottext">dropTail :: forall a. Int -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#dropTail"><span class="hs-identifier hs-var hs-var">dropTail</span></a></span></span><span> </span><span id="local-6989586621680779370"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779370"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680779369"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779369"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-790"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
forall b a. [b] -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621680779368"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; [a] -&gt; [a]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#drop"><span class="hs-identifier hs-var">drop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779370"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779369"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779369"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-791"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-792"></span><span>    </span><span id="local-6989586621680779368"><span class="annot"><span class="annottext">go :: [a] -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621680779368"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779366"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779366"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779365"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779365"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779364"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779364"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779365"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621680779368"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779366"><span class="hs-identifier hs-var">ys</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779364"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-793"></span><span>    </span><span class="annot"><a href="#local-6989586621680779368"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- Stop when ys runs out</span><span>
</span><span id="line-794"></span><span>                           </span><span class="hs-comment">-- It'll always run out before xs does</span><span>
</span><span id="line-795"></span><span>
</span><span id="line-796"></span><span class="hs-comment">-- dropWhile from the end of a list. This is similar to Data.List.dropWhileEnd,</span><span>
</span><span id="line-797"></span><span class="hs-comment">-- but is lazy in the elements and strict in the spine. For reasonably short lists,</span><span>
</span><span id="line-798"></span><span class="hs-comment">-- such as path names and typical lines of text, dropWhileEndLE is generally</span><span>
</span><span id="line-799"></span><span class="hs-comment">-- faster than dropWhileEnd. Its advantage is magnified when the predicate is</span><span>
</span><span id="line-800"></span><span class="hs-comment">-- expensive--using dropWhileEndLE isSpace to strip the space off a line of text</span><span>
</span><span id="line-801"></span><span class="hs-comment">-- is generally much faster than using dropWhileEnd isSpace for that purpose.</span><span>
</span><span id="line-802"></span><span class="hs-comment">-- Specification: dropWhileEndLE p = reverse . dropWhile p . reverse</span><span>
</span><span id="line-803"></span><span class="hs-comment">-- Pay attention to the short-circuit (&amp;&amp;)! The order of its arguments is the only</span><span>
</span><span id="line-804"></span><span class="hs-comment">-- difference between dropWhileEnd and dropWhileEndLE.</span><span>
</span><span id="line-805"></span><span id="local-6989586621680779363"><span class="annot"><a href="GHC.Utils.Misc.html#dropWhileEndLE"><span class="hs-identifier hs-type">dropWhileEndLE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680779363"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779363"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779363"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-806"></span><span id="dropWhileEndLE"><span class="annot"><span class="annottext">dropWhileEndLE :: forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#dropWhileEndLE"><span class="hs-identifier hs-var hs-var">dropWhileEndLE</span></a></span></span><span> </span><span id="local-6989586621680779360"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779360"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; [a] -&gt; [a]) -&gt; [a] -&gt; [a] -&gt; [a]
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680779358"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779358"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621680779357"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779357"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779357"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779360"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779358"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779358"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779357"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-807"></span><span>
</span><span id="line-808"></span><span class="hs-comment">-- | @spanEnd p l == reverse (span p (reverse l))@. The first list</span><span>
</span><span id="line-809"></span><span class="hs-comment">-- returns actually comes after the second list (when you look at the</span><span>
</span><span id="line-810"></span><span class="hs-comment">-- input list).</span><span>
</span><span id="line-811"></span><span id="local-6989586621680780249"><span class="annot"><a href="GHC.Utils.Misc.html#spanEnd"><span class="hs-identifier hs-type">spanEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780249"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780249"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780249"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780249"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span><span>
</span><span id="line-812"></span><span id="spanEnd"><span class="annot"><span class="annottext">spanEnd :: forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="GHC.Utils.Misc.html#spanEnd"><span class="hs-identifier hs-var hs-var">spanEnd</span></a></span></span><span> </span><span id="local-6989586621680779356"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779356"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621680779355"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779355"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a] -&gt; [a] -&gt; ([a], [a])
</span><a href="#local-6989586621680779354"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779355"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779355"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-813"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680779354"><span class="annot"><span class="annottext">go :: [a] -&gt; [a] -&gt; [a] -&gt; [a] -&gt; ([a], [a])
</span><a href="#local-6989586621680779354"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621680779353"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779353"><span class="hs-identifier hs-var">yes</span></a></span></span><span> </span><span id="local-6989586621680779352"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779352"><span class="hs-identifier hs-var">_rev_yes</span></a></span></span><span> </span><span id="local-6989586621680779351"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779351"><span class="hs-identifier hs-var">rev_no</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779353"><span class="hs-identifier hs-var">yes</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779351"><span class="hs-identifier hs-var">rev_no</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-814"></span><span>        </span><span class="annot"><a href="#local-6989586621680779354"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680779350"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779350"><span class="hs-identifier hs-var">yes</span></a></span></span><span> </span><span id="local-6989586621680779349"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779349"><span class="hs-identifier hs-var">rev_yes</span></a></span></span><span>  </span><span id="local-6989586621680779348"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779348"><span class="hs-identifier hs-var">rev_no</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779347"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779347"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779346"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779346"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-815"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680779356"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779347"><span class="hs-identifier hs-var">x</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a] -&gt; [a] -&gt; ([a], [a])
</span><a href="#local-6989586621680779354"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779350"><span class="hs-identifier hs-var">yes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779347"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779349"><span class="hs-identifier hs-var">rev_yes</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779348"><span class="hs-identifier hs-var">rev_no</span></a></span><span>                  </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779346"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-816"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a] -&gt; [a] -&gt; ([a], [a])
</span><a href="#local-6989586621680779354"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779346"><span class="hs-identifier hs-var">xs</span></a></span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779347"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779349"><span class="hs-identifier hs-var">rev_yes</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779348"><span class="hs-identifier hs-var">rev_no</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779346"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-817"></span><span>
</span><span id="line-818"></span><span class="hs-comment">-- | Get the last two elements in a list. Partial!</span><span>
</span><span id="line-819"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#last2"><span class="hs-pragma hs-type">last2</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-820"></span><span id="local-6989586621680780247"><span class="annot"><a href="GHC.Utils.Misc.html#last2"><span class="hs-identifier hs-type">last2</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780247"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780247"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780247"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-821"></span><span id="last2"><span class="annot"><span class="annottext">last2 :: forall a. [a] -&gt; (a, a)
</span><a href="GHC.Utils.Misc.html#last2"><span class="hs-identifier hs-var hs-var">last2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((a, a) -&gt; a -&gt; (a, a)) -&gt; (a, a) -&gt; [a] -&gt; (a, a)
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621680779343"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779343"><span class="hs-identifier hs-var">x2</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680779342"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779342"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779343"><span class="hs-identifier hs-var">x2</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779342"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
forall {a}. a
</span><a href="#local-6989586621680779341"><span class="hs-identifier hs-var">partialError</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">a
forall {a}. a
</span><a href="#local-6989586621680779341"><span class="hs-identifier hs-var">partialError</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-822"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-823"></span><span>    </span><span id="local-6989586621680779341"><span class="annot"><span class="annottext">partialError :: a
</span><a href="#local-6989586621680779341"><span class="hs-identifier hs-var hs-var">partialError</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; a
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;last2 - list length less than two&quot;</span></span><span>
</span><span id="line-824"></span><span>
</span><span id="line-825"></span><span id="local-6989586621680780242"><span class="annot"><a href="GHC.Utils.Misc.html#lastMaybe"><span class="hs-identifier hs-type">lastMaybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780242"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780242"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-826"></span><span id="lastMaybe"><span class="annot"><span class="annottext">lastMaybe :: forall a. [a] -&gt; Maybe a
</span><a href="GHC.Utils.Misc.html#lastMaybe"><span class="hs-identifier hs-var hs-var">lastMaybe</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-827"></span><span class="annot"><a href="GHC.Utils.Misc.html#lastMaybe"><span class="hs-identifier hs-var">lastMaybe</span></a></span><span> </span><span id="local-6989586621680779340"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779340"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Maybe a) -&gt; a -&gt; Maybe a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; a
forall a. [a] -&gt; a
</span><a href="../../base/src/GHC.List.html#last"><span class="hs-identifier hs-var">last</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779340"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-828"></span><span>
</span><span id="line-829"></span><span class="hs-comment">-- | Split a list into its last element and the initial part of the list.</span><span>
</span><span id="line-830"></span><span class="hs-comment">-- @snocView xs = Just (init xs, last xs)@ for non-empty lists.</span><span>
</span><span id="line-831"></span><span class="hs-comment">-- @snocView xs = Nothing@ otherwise.</span><span>
</span><span id="line-832"></span><span class="hs-comment">-- Unless both parts of the result are guaranteed to be used</span><span>
</span><span id="line-833"></span><span class="hs-comment">-- prefer separate calls to @last@ + @init@.</span><span>
</span><span id="line-834"></span><span class="hs-comment">-- If you are guaranteed to use both, this will</span><span>
</span><span id="line-835"></span><span class="hs-comment">-- be more efficient.</span><span>
</span><span id="line-836"></span><span id="local-6989586621680780237"><span class="annot"><a href="GHC.Utils.Misc.html#snocView"><span class="hs-identifier hs-type">snocView</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780237"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780237"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780237"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-837"></span><span id="snocView"><span class="annot"><span class="annottext">snocView :: forall a. [a] -&gt; Maybe ([a], a)
</span><a href="GHC.Utils.Misc.html#snocView"><span class="hs-identifier hs-var hs-var">snocView</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe ([a], a)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-838"></span><span class="annot"><a href="GHC.Utils.Misc.html#snocView"><span class="hs-identifier hs-var">snocView</span></a></span><span> </span><span id="local-6989586621680779338"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779338"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-839"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779337"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779337"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680779336"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779336"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; ([a], a)
forall a. [a] -&gt; ([a], a)
</span><a href="#local-6989586621680779335"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779338"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-840"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([a], a) -&gt; Maybe ([a], a)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779337"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779336"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-841"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-842"></span><span>    </span><span id="local-6989586621680780235"><span class="annot"><a href="#local-6989586621680779335"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780235"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780235"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780235"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-843"></span><span>    </span><span id="local-6989586621680779335"><span class="annot"><span class="annottext">go :: forall a. [a] -&gt; ([a], a)
</span><a href="#local-6989586621680779335"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">[</span><span id="local-6989586621680779332"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779332"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779332"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-844"></span><span>    </span><span class="annot"><a href="#local-6989586621680779335"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779331"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779331"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779330"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779330"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-845"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span id="local-6989586621680779329"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779329"><span class="hs-identifier hs-var">xs'</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680779328"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779328"><span class="hs-identifier hs-var">x'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; ([a], a)
forall a. [a] -&gt; ([a], a)
</span><a href="#local-6989586621680779335"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779330"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-846"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779331"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779329"><span class="hs-identifier hs-var">xs'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779328"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-847"></span><span>    </span><span class="annot"><a href="#local-6989586621680779335"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; ([a], a)
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;impossible&quot;</span></span><span>
</span><span id="line-848"></span><span>
</span><span id="line-849"></span><span class="annot"><a href="GHC.Utils.Misc.html#split"><span class="hs-identifier hs-type">split</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-850"></span><span id="split"><span class="annot"><span class="annottext">split :: Char -&gt; String -&gt; [String]
</span><a href="GHC.Utils.Misc.html#split"><span class="hs-identifier hs-var hs-var">split</span></a></span></span><span> </span><span id="local-6989586621680779326"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779326"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680779325"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779325"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779324"><span class="hs-identifier hs-var">rest</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-851"></span><span>                </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779323"><span class="hs-identifier hs-var">chunk</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-852"></span><span>                </span><span class="annot"><span class="annottext">Char
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779322"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779322"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779323"><span class="hs-identifier hs-var">chunk</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; [String]
</span><a href="GHC.Utils.Misc.html#split"><span class="hs-identifier hs-var">split</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779326"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779322"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-853"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779323"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779323"><span class="hs-identifier hs-var">chunk</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779324"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779324"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#break"><span class="hs-identifier hs-var">break</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779326"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779325"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-854"></span><span>
</span><span id="line-855"></span><span class="hs-comment">-- | Convert a word to title case by capitalising the first letter</span><span>
</span><span id="line-856"></span><span class="annot"><a href="GHC.Utils.Misc.html#capitalise"><span class="hs-identifier hs-type">capitalise</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-857"></span><span id="capitalise"><span class="annot"><span class="annottext">capitalise :: String -&gt; String
</span><a href="GHC.Utils.Misc.html#capitalise"><span class="hs-identifier hs-var hs-var">capitalise</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-858"></span><span class="annot"><a href="GHC.Utils.Misc.html#capitalise"><span class="hs-identifier hs-var">capitalise</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779319"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779319"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779318"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779318"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="../../base/src/GHC.Unicode.html#toUpper"><span class="hs-identifier hs-var">toUpper</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779319"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779318"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-859"></span><span>
</span><span id="line-860"></span><span>
</span><span id="line-861"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection[Utils-comparison]{Comparisons}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-868"></span><span>
</span><span id="line-869"></span><span class="annot"><a href="GHC.Utils.Misc.html#isEqual"><span class="hs-identifier hs-type">isEqual</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ordering</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-870"></span><span class="hs-comment">-- Often used in (isEqual (a `compare` b))</span><span>
</span><span id="line-871"></span><span id="isEqual"><span class="annot"><span class="annottext">isEqual :: Ordering -&gt; Bool
</span><a href="GHC.Utils.Misc.html#isEqual"><span class="hs-identifier hs-var hs-var">isEqual</span></a></span></span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-872"></span><span class="annot"><a href="GHC.Utils.Misc.html#isEqual"><span class="hs-identifier hs-var">isEqual</span></a></span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-873"></span><span class="annot"><a href="GHC.Utils.Misc.html#isEqual"><span class="hs-identifier hs-var">isEqual</span></a></span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-874"></span><span>
</span><span id="line-875"></span><span class="annot"><a href="GHC.Utils.Misc.html#thenCmp"><span class="hs-identifier hs-type">thenCmp</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ordering</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ordering</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ordering</span></span><span>
</span><span id="line-876"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#thenCmp"><span class="hs-pragma hs-type">thenCmp</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-877"></span><span id="thenCmp"><span class="annot"><span class="annottext">thenCmp :: Ordering -&gt; Ordering -&gt; Ordering
</span><a href="GHC.Utils.Misc.html#thenCmp"><span class="hs-identifier hs-var hs-var">thenCmp</span></a></span></span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span>       </span><span id="local-6989586621680779317"><span class="annot"><span class="annottext">Ordering
</span><a href="#local-6989586621680779317"><span class="hs-identifier hs-var">ordering</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><a href="#local-6989586621680779317"><span class="hs-identifier hs-var">ordering</span></a></span><span>
</span><span id="line-878"></span><span class="annot"><a href="GHC.Utils.Misc.html#thenCmp"><span class="hs-identifier hs-var">thenCmp</span></a></span><span> </span><span id="local-6989586621680779316"><span class="annot"><span class="annottext">Ordering
</span><a href="#local-6989586621680779316"><span class="hs-identifier hs-var">ordering</span></a></span></span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier">_</span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><a href="#local-6989586621680779316"><span class="hs-identifier hs-var">ordering</span></a></span><span>
</span><span id="line-879"></span><span>
</span><span id="line-880"></span><span id="local-6989586621680780231"><span class="annot"><a href="GHC.Utils.Misc.html#eqListBy"><span class="hs-identifier hs-type">eqListBy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780231"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680780231"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780231"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780231"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-881"></span><span id="eqListBy"><span class="annot"><span class="annottext">eqListBy :: forall a. (a -&gt; a -&gt; Bool) -&gt; [a] -&gt; [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#eqListBy"><span class="hs-identifier hs-var hs-var">eqListBy</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-882"></span><span class="annot"><a href="GHC.Utils.Misc.html#eqListBy"><span class="hs-identifier hs-var">eqListBy</span></a></span><span> </span><span id="local-6989586621680779315"><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
</span><a href="#local-6989586621680779315"><span class="hs-identifier hs-var">eq</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779314"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779314"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779313"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779313"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779312"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779312"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779311"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779311"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
</span><a href="#local-6989586621680779315"><span class="hs-identifier hs-var">eq</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779314"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779312"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; Bool) -&gt; [a] -&gt; [a] -&gt; Bool
forall a. (a -&gt; a -&gt; Bool) -&gt; [a] -&gt; [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#eqListBy"><span class="hs-identifier hs-var">eqListBy</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
</span><a href="#local-6989586621680779315"><span class="hs-identifier hs-var">eq</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779313"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779311"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-883"></span><span class="annot"><a href="GHC.Utils.Misc.html#eqListBy"><span class="hs-identifier hs-var">eqListBy</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span>  </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-884"></span><span>
</span><span id="line-885"></span><span id="local-6989586621680780229"><span class="annot"><a href="GHC.Utils.Misc.html#eqMaybeBy"><span class="hs-identifier hs-type">eqMaybeBy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780229"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680780229"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780229"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780229"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-886"></span><span id="eqMaybeBy"><span class="annot"><span class="annottext">eqMaybeBy :: forall a. (a -&gt; a -&gt; Bool) -&gt; Maybe a -&gt; Maybe a -&gt; Bool
</span><a href="GHC.Utils.Misc.html#eqMaybeBy"><span class="hs-identifier hs-var hs-var">eqMaybeBy</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span>  </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-887"></span><span class="annot"><a href="GHC.Utils.Misc.html#eqMaybeBy"><span class="hs-identifier hs-var">eqMaybeBy</span></a></span><span> </span><span id="local-6989586621680779310"><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
</span><a href="#local-6989586621680779310"><span class="hs-identifier hs-var">eq</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680779309"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779309"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680779308"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779308"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
</span><a href="#local-6989586621680779310"><span class="hs-identifier hs-var">eq</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779309"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779308"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-888"></span><span class="annot"><a href="GHC.Utils.Misc.html#eqMaybeBy"><span class="hs-identifier hs-var">eqMaybeBy</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span>  </span><span class="annot"><span class="annottext">Maybe a
</span><span class="hs-identifier">_</span></span><span>        </span><span class="annot"><span class="annottext">Maybe a
</span><span class="hs-identifier">_</span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-889"></span><span>
</span><span id="line-890"></span><span id="local-6989586621680780227"><span class="annot"><a href="GHC.Utils.Misc.html#cmpList"><span class="hs-identifier hs-type">cmpList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780227"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780227"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ordering</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780227"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780227"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ordering</span></span></span><span>
</span><span id="line-891"></span><span>    </span><span class="hs-comment">-- `cmpList' uses a user-specified comparer</span><span>
</span><span id="line-892"></span><span>
</span><span id="line-893"></span><span id="cmpList"><span class="annot"><span class="annottext">cmpList :: forall a. (a -&gt; a -&gt; Ordering) -&gt; [a] -&gt; [a] -&gt; Ordering
</span><a href="GHC.Utils.Misc.html#cmpList"><span class="hs-identifier hs-var hs-var">cmpList</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span>
</span><span id="line-894"></span><span class="annot"><a href="GHC.Utils.Misc.html#cmpList"><span class="hs-identifier hs-var">cmpList</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span>
</span><span id="line-895"></span><span class="annot"><a href="GHC.Utils.Misc.html#cmpList"><span class="hs-identifier hs-var">cmpList</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
</span><span class="hs-identifier">_</span></span><span>   </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span>
</span><span id="line-896"></span><span class="annot"><a href="GHC.Utils.Misc.html#cmpList"><span class="hs-identifier hs-var">cmpList</span></a></span><span> </span><span id="local-6989586621680779307"><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
</span><a href="#local-6989586621680779307"><span class="hs-identifier hs-var">cmp</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779306"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779306"><span class="hs-identifier hs-var">a</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779305"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779305"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779304"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779304"><span class="hs-identifier hs-var">b</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779303"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779303"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-897"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
</span><a href="#local-6989586621680779307"><span class="hs-identifier hs-var">cmp</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779306"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779304"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; Ordering) -&gt; [a] -&gt; [a] -&gt; Ordering
forall a. (a -&gt; a -&gt; Ordering) -&gt; [a] -&gt; [a] -&gt; Ordering
</span><a href="GHC.Utils.Misc.html#cmpList"><span class="hs-identifier hs-var">cmpList</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
</span><a href="#local-6989586621680779307"><span class="hs-identifier hs-var">cmp</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779305"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779303"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">;</span><span> </span><span id="local-6989586621680779302"><span class="annot"><span class="annottext">Ordering
</span><a href="#local-6989586621680779302"><span class="hs-identifier hs-var">xxx</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><a href="#local-6989586621680779302"><span class="hs-identifier hs-var">xxx</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-898"></span><span>
</span><span id="line-899"></span><span class="annot"><a href="GHC.Utils.Misc.html#removeSpaces"><span class="hs-identifier hs-type">removeSpaces</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-900"></span><span id="removeSpaces"><span class="annot"><span class="annottext">removeSpaces :: String -&gt; String
</span><a href="GHC.Utils.Misc.html#removeSpaces"><span class="hs-identifier hs-var hs-var">removeSpaces</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; String
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#dropWhileEndLE"><span class="hs-identifier hs-var">dropWhileEndLE</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; String) -&gt; (String -&gt; String) -&gt; String -&gt; String
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; String
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#dropWhile"><span class="hs-identifier hs-var">dropWhile</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span>
</span><span id="line-901"></span><span>
</span><span id="line-902"></span><span class="hs-comment">-- Boolean operators lifted to Applicative</span><span>
</span><span id="line-903"></span><span id="local-6989586621680780225"><span class="annot"><a href="GHC.Utils.Misc.html#%3C%26%26%3E"><span class="hs-operator hs-type">(&lt;&amp;&amp;&gt;)</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780225"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780225"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780225"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780225"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-904"></span><span id="%3C%26%26%3E"><span class="annot"><span class="annottext">&lt;&amp;&amp;&gt; :: forall (f :: * -&gt; *). Applicative f =&gt; f Bool -&gt; f Bool -&gt; f Bool
</span><a href="GHC.Utils.Misc.html#%3C%26%26%3E"><span class="hs-operator hs-var hs-var">(&lt;&amp;&amp;&gt;)</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool -&gt; Bool) -&gt; f Bool -&gt; f Bool -&gt; f Bool
forall (f :: * -&gt; *) a b c.
Applicative f =&gt;
(a -&gt; b -&gt; c) -&gt; f a -&gt; f b -&gt; f c
</span><a href="../../base/src/GHC.Base.html#liftA2"><span class="hs-identifier hs-var">liftA2</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">(&amp;&amp;)</span></span><span>
</span><span id="line-905"></span><span class="hs-keyword">infixr</span><span> </span><span class="hs-number">3</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#%3C%26%26%3E"><span class="hs-operator hs-type">&lt;&amp;&amp;&gt;</span></a></span><span> </span><span class="hs-comment">-- same as (&amp;&amp;)</span><span>
</span><span id="line-906"></span><span>
</span><span id="line-907"></span><span id="local-6989586621680779298"><span class="annot"><a href="GHC.Utils.Misc.html#%3C%7C%7C%3E"><span class="hs-operator hs-type">(&lt;||&gt;)</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680779298"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680779298"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680779298"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680779298"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-908"></span><span id="%3C%7C%7C%3E"><span class="annot"><span class="annottext">&lt;||&gt; :: forall (f :: * -&gt; *). Applicative f =&gt; f Bool -&gt; f Bool -&gt; f Bool
</span><a href="GHC.Utils.Misc.html#%3C%7C%7C%3E"><span class="hs-operator hs-var hs-var">(&lt;||&gt;)</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool -&gt; Bool) -&gt; f Bool -&gt; f Bool -&gt; f Bool
forall (f :: * -&gt; *) a b c.
Applicative f =&gt;
(a -&gt; b -&gt; c) -&gt; f a -&gt; f b -&gt; f c
</span><a href="../../base/src/GHC.Base.html#liftA2"><span class="hs-identifier hs-var">liftA2</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">(||)</span></span><span>
</span><span id="line-909"></span><span class="hs-keyword">infixr</span><span> </span><span class="hs-number">2</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#%3C%7C%7C%3E"><span class="hs-operator hs-type">&lt;||&gt;</span></a></span><span> </span><span class="hs-comment">-- same as (||)</span><span>
</span><span id="line-910"></span><span>
</span><span id="line-911"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{Edit distance}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-918"></span><span>
</span><span id="line-919"></span><span class="hs-comment">-- | Find the &quot;restricted&quot; Damerau-Levenshtein edit distance between two strings.</span><span>
</span><span id="line-920"></span><span class="hs-comment">-- See: &lt;http://en.wikipedia.org/wiki/Damerau-Levenshtein_distance&gt;.</span><span>
</span><span id="line-921"></span><span class="hs-comment">-- Based on the algorithm presented in &quot;A Bit-Vector Algorithm for Computing</span><span>
</span><span id="line-922"></span><span class="hs-comment">-- Levenshtein and Damerau Edit Distances&quot; in PSC'02 (Heikki Hyyro).</span><span>
</span><span id="line-923"></span><span class="hs-comment">-- See http://www.cs.uta.fi/~helmu/pubs/psc02.pdf and</span><span>
</span><span id="line-924"></span><span class="hs-comment">--     http://www.cs.uta.fi/~helmu/pubs/PSCerr.html for an explanation</span><span>
</span><span id="line-925"></span><span class="annot"><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistance"><span class="hs-identifier hs-type">restrictedDamerauLevenshteinDistance</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-926"></span><span id="restrictedDamerauLevenshteinDistance"><span class="annot"><span class="annottext">restrictedDamerauLevenshteinDistance :: String -&gt; String -&gt; Int
</span><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistance"><span class="hs-identifier hs-var hs-var">restrictedDamerauLevenshteinDistance</span></a></span></span><span> </span><span id="local-6989586621680779293"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779293"><span class="hs-identifier hs-var">str1</span></a></span></span><span> </span><span id="local-6989586621680779292"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779292"><span class="hs-identifier hs-var">str2</span></a></span></span><span>
</span><span id="line-927"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; String -&gt; String -&gt; Int
</span><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistanceWithLengths"><span class="hs-identifier hs-var">restrictedDamerauLevenshteinDistanceWithLengths</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779290"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779289"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779293"><span class="hs-identifier hs-var">str1</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779292"><span class="hs-identifier hs-var">str2</span></a></span><span>
</span><span id="line-928"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-929"></span><span>    </span><span id="local-6989586621680779290"><span class="annot"><span class="annottext">m :: Int
</span><a href="#local-6989586621680779290"><span class="hs-identifier hs-var hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779293"><span class="hs-identifier hs-var">str1</span></a></span><span>
</span><span id="line-930"></span><span>    </span><span id="local-6989586621680779289"><span class="annot"><span class="annottext">n :: Int
</span><a href="#local-6989586621680779289"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779292"><span class="hs-identifier hs-var">str2</span></a></span><span>
</span><span id="line-931"></span><span>
</span><span id="line-932"></span><span class="annot"><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistanceWithLengths"><span class="hs-identifier hs-type">restrictedDamerauLevenshteinDistanceWithLengths</span></a></span><span>
</span><span id="line-933"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-934"></span><span id="restrictedDamerauLevenshteinDistanceWithLengths"><span class="annot"><span class="annottext">restrictedDamerauLevenshteinDistanceWithLengths :: Int -&gt; Int -&gt; String -&gt; String -&gt; Int
</span><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistanceWithLengths"><span class="hs-identifier hs-var hs-var">restrictedDamerauLevenshteinDistanceWithLengths</span></a></span></span><span> </span><span id="local-6989586621680779285"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779285"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621680779284"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779284"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680779283"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779283"><span class="hs-identifier hs-var">str1</span></a></span></span><span> </span><span id="local-6989586621680779282"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779282"><span class="hs-identifier hs-var">str2</span></a></span></span><span>
</span><span id="line-935"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779285"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779284"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-936"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779284"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">32</span></span><span> </span><span class="hs-comment">-- n must be larger so this check is sufficient</span><span>
</span><span id="line-937"></span><span>    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Int -&gt; Int -&gt; String -&gt; String -&gt; Int
forall bv.
(Bits bv, Num bv) =&gt;
bv -&gt; Int -&gt; Int -&gt; String -&gt; String -&gt; Int
</span><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistance%27"><span class="hs-identifier hs-var">restrictedDamerauLevenshteinDistance'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word32
forall a. HasCallStack =&gt; a
</span><a href="../../base/src/GHC.Err.html#undefined"><span class="hs-identifier hs-var">undefined</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-identifier hs-type">Word32</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779285"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779284"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779283"><span class="hs-identifier hs-var">str1</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779282"><span class="hs-identifier hs-var">str2</span></a></span><span>
</span><span id="line-938"></span><span>    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; Int -&gt; String -&gt; String -&gt; Int
forall bv.
(Bits bv, Num bv) =&gt;
bv -&gt; Int -&gt; Int -&gt; String -&gt; String -&gt; Int
</span><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistance%27"><span class="hs-identifier hs-var">restrictedDamerauLevenshteinDistance'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
forall a. HasCallStack =&gt; a
</span><a href="../../base/src/GHC.Err.html#undefined"><span class="hs-identifier hs-var">undefined</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779285"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779284"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779283"><span class="hs-identifier hs-var">str1</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779282"><span class="hs-identifier hs-var">str2</span></a></span><span>
</span><span id="line-939"></span><span>
</span><span id="line-940"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-941"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779285"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">32</span></span><span> </span><span class="hs-comment">-- m must be larger so this check is sufficient</span><span>
</span><span id="line-942"></span><span>    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Int -&gt; Int -&gt; String -&gt; String -&gt; Int
forall bv.
(Bits bv, Num bv) =&gt;
bv -&gt; Int -&gt; Int -&gt; String -&gt; String -&gt; Int
</span><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistance%27"><span class="hs-identifier hs-var">restrictedDamerauLevenshteinDistance'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word32
forall a. HasCallStack =&gt; a
</span><a href="../../base/src/GHC.Err.html#undefined"><span class="hs-identifier hs-var">undefined</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-identifier hs-type">Word32</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779284"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779285"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779282"><span class="hs-identifier hs-var">str2</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779283"><span class="hs-identifier hs-var">str1</span></a></span><span>
</span><span id="line-943"></span><span>    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; Int -&gt; String -&gt; String -&gt; Int
forall bv.
(Bits bv, Num bv) =&gt;
bv -&gt; Int -&gt; Int -&gt; String -&gt; String -&gt; Int
</span><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistance%27"><span class="hs-identifier hs-var">restrictedDamerauLevenshteinDistance'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
forall a. HasCallStack =&gt; a
</span><a href="../../base/src/GHC.Err.html#undefined"><span class="hs-identifier hs-var">undefined</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779284"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779285"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779282"><span class="hs-identifier hs-var">str2</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779283"><span class="hs-identifier hs-var">str1</span></a></span><span>
</span><span id="line-944"></span><span>
</span><span id="line-945"></span><span id="local-6989586621680780218"><span class="annot"><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistance%27"><span class="hs-identifier hs-type">restrictedDamerauLevenshteinDistance'</span></a></span><span>
</span><span id="line-946"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780218"><span class="hs-identifier hs-type">bv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Num.html#Num"><span class="hs-identifier hs-type">Num</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780218"><span class="hs-identifier hs-type">bv</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780218"><span class="hs-identifier hs-type">bv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span></span><span>
</span><span id="line-947"></span><span id="restrictedDamerauLevenshteinDistance%27"><span class="annot"><span class="annottext">restrictedDamerauLevenshteinDistance' :: forall bv.
(Bits bv, Num bv) =&gt;
bv -&gt; Int -&gt; Int -&gt; String -&gt; String -&gt; Int
</span><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistance%27"><span class="hs-identifier hs-var hs-var">restrictedDamerauLevenshteinDistance'</span></a></span></span><span> </span><span id="local-6989586621680779268"><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779268"><span class="hs-identifier hs-var">_bv_dummy</span></a></span></span><span> </span><span id="local-6989586621680779267"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779267"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621680779266"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779266"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680779265"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779265"><span class="hs-identifier hs-var">str1</span></a></span></span><span> </span><span id="local-6989586621680779264"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779264"><span class="hs-identifier hs-var">str2</span></a></span></span><span>
</span><span id="line-948"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779265"><span class="hs-identifier hs-var">str1</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779266"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-949"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(bv, bv, bv, bv, Int) -&gt; Int
forall {a} {b} {c} {d} {e}. (a, b, c, d, e) -&gt; e
</span><a href="#local-6989586621680779263"><span class="hs-identifier hs-var">extractAnswer</span></a></span><span> </span><span class="annot"><span class="annottext">((bv, bv, bv, bv, Int) -&gt; Int) -&gt; (bv, bv, bv, bv, Int) -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-950"></span><span>                 </span><span class="annot"><span class="annottext">((bv, bv, bv, bv, Int) -&gt; Char -&gt; (bv, bv, bv, bv, Int))
-&gt; (bv, bv, bv, bv, Int) -&gt; String -&gt; (bv, bv, bv, bv, Int)
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap bv
-&gt; bv
-&gt; bv
-&gt; (bv, bv, bv, bv, Int)
-&gt; Char
-&gt; (bv, bv, bv, bv, Int)
forall bv.
(Bits bv, Num bv) =&gt;
IntMap bv
-&gt; bv
-&gt; bv
-&gt; (bv, bv, bv, bv, Int)
-&gt; Char
-&gt; (bv, bv, bv, bv, Int)
</span><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistanceWorker"><span class="hs-identifier hs-var">restrictedDamerauLevenshteinDistanceWorker</span></a></span><span>
</span><span id="line-951"></span><span>                             </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; IntMap bv
forall bv. (Bits bv, Num bv) =&gt; String -&gt; IntMap bv
</span><a href="GHC.Utils.Misc.html#matchVectors"><span class="hs-identifier hs-var">matchVectors</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779265"><span class="hs-identifier hs-var">str1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779260"><span class="hs-identifier hs-var">top_bit_mask</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779259"><span class="hs-identifier hs-var">vector_mask</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-952"></span><span>                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">bv
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bv
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779258"><span class="hs-identifier hs-var">m_ones</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bv
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779267"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779264"><span class="hs-identifier hs-var">str2</span></a></span><span>
</span><span id="line-953"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-954"></span><span>    </span><span id="local-6989586621680779258"><span class="annot"><span class="annottext">m_ones :: bv
</span><a href="#local-6989586621680779258"><span class="hs-identifier hs-var">m_ones</span></a></span></span><span class="hs-glyph">@</span><span id="local-6989586621680779259"><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779259"><span class="hs-identifier hs-var">vector_mask</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">bv
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">bv -&gt; Int -&gt; bv
forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Real.html#%5E"><span class="hs-operator hs-var">^</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779267"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><span class="hs-number">1</span></span><span>
</span><span id="line-955"></span><span>    </span><span id="local-6989586621680779260"><span class="annot"><span class="annottext">top_bit_mask :: bv
</span><a href="#local-6989586621680779260"><span class="hs-identifier hs-var hs-var">top_bit_mask</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">bv
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">bv -&gt; Int -&gt; bv
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779267"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall a. a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#asTypeOf"><span class="hs-operator hs-var">`asTypeOf`</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779268"><span class="hs-identifier hs-var">_bv_dummy</span></a></span><span>
</span><span id="line-956"></span><span>    </span><span id="local-6989586621680779263"><span class="annot"><span class="annottext">extractAnswer :: (a, b, c, d, e) -&gt; e
</span><a href="#local-6989586621680779263"><span class="hs-identifier hs-var hs-var">extractAnswer</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">c
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">d
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779245"><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621680779245"><span class="hs-identifier hs-var">distance</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621680779245"><span class="hs-identifier hs-var">distance</span></a></span><span>
</span><span id="line-957"></span><span>
</span><span id="line-958"></span><span id="local-6989586621680780208"><span class="annot"><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistanceWorker"><span class="hs-identifier hs-type">restrictedDamerauLevenshteinDistanceWorker</span></a></span><span>
</span><span id="line-959"></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780208"><span class="hs-identifier hs-type">bv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Num.html#Num"><span class="hs-identifier hs-type">Num</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780208"><span class="hs-identifier hs-type">bv</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../containers/src/Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IM.IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780208"><span class="hs-identifier hs-type">bv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780208"><span class="hs-identifier hs-type">bv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780208"><span class="hs-identifier hs-type">bv</span></a></span><span>
</span><span id="line-960"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780208"><span class="hs-identifier hs-type">bv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780208"><span class="hs-identifier hs-type">bv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780208"><span class="hs-identifier hs-type">bv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780208"><span class="hs-identifier hs-type">bv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780208"><span class="hs-identifier hs-type">bv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780208"><span class="hs-identifier hs-type">bv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780208"><span class="hs-identifier hs-type">bv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780208"><span class="hs-identifier hs-type">bv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">)</span></span><span>
</span><span id="line-961"></span><span id="restrictedDamerauLevenshteinDistanceWorker"><span class="annot"><span class="annottext">restrictedDamerauLevenshteinDistanceWorker :: forall bv.
(Bits bv, Num bv) =&gt;
IntMap bv
-&gt; bv
-&gt; bv
-&gt; (bv, bv, bv, bv, Int)
-&gt; Char
-&gt; (bv, bv, bv, bv, Int)
</span><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistanceWorker"><span class="hs-identifier hs-var hs-var">restrictedDamerauLevenshteinDistanceWorker</span></a></span></span><span> </span><span id="local-6989586621680779240"><span class="annot"><span class="annottext">IntMap bv
</span><a href="#local-6989586621680779240"><span class="hs-identifier hs-var">str1_mvs</span></a></span></span><span> </span><span id="local-6989586621680779239"><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779239"><span class="hs-identifier hs-var">top_bit_mask</span></a></span></span><span> </span><span id="local-6989586621680779238"><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779238"><span class="hs-identifier hs-var">vector_mask</span></a></span></span><span>
</span><span id="line-962"></span><span>                                           </span><span class="hs-special">(</span><span id="local-6989586621680779237"><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779237"><span class="hs-identifier hs-var">pm</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779236"><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779236"><span class="hs-identifier hs-var">d0</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779235"><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779235"><span class="hs-identifier hs-var">vp</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779234"><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779234"><span class="hs-identifier hs-var">vn</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779233"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779233"><span class="hs-identifier hs-var">distance</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680779232"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779232"><span class="hs-identifier hs-var">char2</span></a></span></span><span>
</span><span id="line-963"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap bv -&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
</span><span class="hs-identifier hs-var">seq</span></span><span> </span><span class="annot"><span class="annottext">IntMap bv
</span><a href="#local-6989586621680779240"><span class="hs-identifier hs-var">str1_mvs</span></a></span><span> </span><span class="annot"><span class="annottext">((bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int))
-&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
</span><span class="hs-identifier hs-var">seq</span></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779239"><span class="hs-identifier hs-var">top_bit_mask</span></a></span><span> </span><span class="annot"><span class="annottext">((bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int))
-&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
</span><span class="hs-identifier hs-var">seq</span></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779238"><span class="hs-identifier hs-var">vector_mask</span></a></span><span> </span><span class="annot"><span class="annottext">((bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int))
-&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-964"></span><span>    </span><span class="annot"><span class="annottext">bv -&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
</span><span class="hs-identifier hs-var">seq</span></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779231"><span class="hs-identifier hs-var">pm'</span></a></span><span> </span><span class="annot"><span class="annottext">((bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int))
-&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
</span><span class="hs-identifier hs-var">seq</span></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779230"><span class="hs-identifier hs-var">d0'</span></a></span><span> </span><span class="annot"><span class="annottext">((bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int))
-&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
</span><span class="hs-identifier hs-var">seq</span></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779229"><span class="hs-identifier hs-var">vp'</span></a></span><span> </span><span class="annot"><span class="annottext">((bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int))
-&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
</span><span class="hs-identifier hs-var">seq</span></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779228"><span class="hs-identifier hs-var">vn'</span></a></span><span> </span><span class="annot"><span class="annottext">((bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int))
-&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-965"></span><span>    </span><span class="annot"><span class="annottext">Int -&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
</span><span class="hs-identifier hs-var">seq</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779227"><span class="hs-identifier hs-var">distance''</span></a></span><span> </span><span class="annot"><span class="annottext">((bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int))
-&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
</span><span class="hs-identifier hs-var">seq</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779232"><span class="hs-identifier hs-var">char2</span></a></span><span> </span><span class="annot"><span class="annottext">((bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int))
-&gt; (bv, bv, bv, bv, Int) -&gt; (bv, bv, bv, bv, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-966"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779231"><span class="hs-identifier hs-var">pm'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779230"><span class="hs-identifier hs-var">d0'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779229"><span class="hs-identifier hs-var">vp'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779228"><span class="hs-identifier hs-var">vn'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779227"><span class="hs-identifier hs-var">distance''</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-967"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-968"></span><span>    </span><span id="local-6989586621680779231"><span class="annot"><span class="annottext">pm' :: bv
</span><a href="#local-6989586621680779231"><span class="hs-identifier hs-var hs-var">pm'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">bv -&gt; Int -&gt; IntMap bv -&gt; bv
forall a. a -&gt; Int -&gt; IntMap a -&gt; a
</span><a href="../../containers/src/Data.IntMap.Internal.html#findWithDefault"><span class="hs-identifier hs-var">IM.findWithDefault</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="../../base/src/GHC.Base.html#ord"><span class="hs-identifier hs-var">ord</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779232"><span class="hs-identifier hs-var">char2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap bv
</span><a href="#local-6989586621680779240"><span class="hs-identifier hs-var">str1_mvs</span></a></span><span>
</span><span id="line-969"></span><span>
</span><span id="line-970"></span><span>    </span><span id="local-6989586621680779230"><span class="annot"><span class="annottext">d0' :: bv
</span><a href="#local-6989586621680779230"><span class="hs-identifier hs-var hs-var">d0'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="GHC.Utils.Misc.html#sizedComplement"><span class="hs-identifier hs-var">sizedComplement</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779238"><span class="hs-identifier hs-var">vector_mask</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779236"><span class="hs-identifier hs-var">d0</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779231"><span class="hs-identifier hs-var">pm'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">bv -&gt; Int -&gt; bv
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779237"><span class="hs-identifier hs-var">pm</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-971"></span><span>      </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%7C."><span class="hs-operator hs-var">.|.</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779231"><span class="hs-identifier hs-var">pm'</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779235"><span class="hs-identifier hs-var">vp</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779235"><span class="hs-identifier hs-var">vp</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779238"><span class="hs-identifier hs-var">vector_mask</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#xor"><span class="hs-operator hs-var">`xor`</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779235"><span class="hs-identifier hs-var">vp</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%7C."><span class="hs-operator hs-var">.|.</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779231"><span class="hs-identifier hs-var">pm'</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%7C."><span class="hs-operator hs-var">.|.</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779234"><span class="hs-identifier hs-var">vn</span></a></span><span>
</span><span id="line-972"></span><span>          </span><span class="hs-comment">-- No need to mask the shiftL because of the restricted range of pm</span><span>
</span><span id="line-973"></span><span>
</span><span id="line-974"></span><span>    </span><span id="local-6989586621680779206"><span class="annot"><span class="annottext">hp' :: bv
</span><a href="#local-6989586621680779206"><span class="hs-identifier hs-var hs-var">hp'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779234"><span class="hs-identifier hs-var">vn</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%7C."><span class="hs-operator hs-var">.|.</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="GHC.Utils.Misc.html#sizedComplement"><span class="hs-identifier hs-var">sizedComplement</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779238"><span class="hs-identifier hs-var">vector_mask</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779230"><span class="hs-identifier hs-var">d0'</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%7C."><span class="hs-operator hs-var">.|.</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779235"><span class="hs-identifier hs-var">vp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-975"></span><span>    </span><span id="local-6989586621680779204"><span class="annot"><span class="annottext">hn' :: bv
</span><a href="#local-6989586621680779204"><span class="hs-identifier hs-var hs-var">hn'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779230"><span class="hs-identifier hs-var">d0'</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779235"><span class="hs-identifier hs-var">vp</span></a></span><span>
</span><span id="line-976"></span><span>
</span><span id="line-977"></span><span>    </span><span id="local-6989586621680779199"><span class="annot"><span class="annottext">hp'_shift :: bv
</span><a href="#local-6989586621680779199"><span class="hs-identifier hs-var hs-var">hp'_shift</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779206"><span class="hs-identifier hs-var">hp'</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; Int -&gt; bv
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%7C."><span class="hs-operator hs-var">.|.</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779238"><span class="hs-identifier hs-var">vector_mask</span></a></span><span>
</span><span id="line-978"></span><span>    </span><span id="local-6989586621680779196"><span class="annot"><span class="annottext">hn'_shift :: bv
</span><a href="#local-6989586621680779196"><span class="hs-identifier hs-var hs-var">hn'_shift</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779204"><span class="hs-identifier hs-var">hn'</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; Int -&gt; bv
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779238"><span class="hs-identifier hs-var">vector_mask</span></a></span><span>
</span><span id="line-979"></span><span>    </span><span id="local-6989586621680779229"><span class="annot"><span class="annottext">vp' :: bv
</span><a href="#local-6989586621680779229"><span class="hs-identifier hs-var hs-var">vp'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779196"><span class="hs-identifier hs-var">hn'_shift</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%7C."><span class="hs-operator hs-var">.|.</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="GHC.Utils.Misc.html#sizedComplement"><span class="hs-identifier hs-var">sizedComplement</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779238"><span class="hs-identifier hs-var">vector_mask</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779230"><span class="hs-identifier hs-var">d0'</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%7C."><span class="hs-operator hs-var">.|.</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779199"><span class="hs-identifier hs-var">hp'_shift</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-980"></span><span>    </span><span id="local-6989586621680779228"><span class="annot"><span class="annottext">vn' :: bv
</span><a href="#local-6989586621680779228"><span class="hs-identifier hs-var hs-var">vn'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779230"><span class="hs-identifier hs-var">d0'</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779199"><span class="hs-identifier hs-var">hp'_shift</span></a></span><span>
</span><span id="line-981"></span><span>
</span><span id="line-982"></span><span>    </span><span id="local-6989586621680779186"><span class="annot"><span class="annottext">distance' :: Int
</span><a href="#local-6989586621680779186"><span class="hs-identifier hs-var hs-var">distance'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779206"><span class="hs-identifier hs-var">hp'</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779239"><span class="hs-identifier hs-var">top_bit_mask</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">bv
</span><span class="hs-number">0</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779233"><span class="hs-identifier hs-var">distance</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779233"><span class="hs-identifier hs-var">distance</span></a></span><span>
</span><span id="line-983"></span><span>    </span><span id="local-6989586621680779227"><span class="annot"><span class="annottext">distance'' :: Int
</span><a href="#local-6989586621680779227"><span class="hs-identifier hs-var hs-var">distance''</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779204"><span class="hs-identifier hs-var">hn'</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779239"><span class="hs-identifier hs-var">top_bit_mask</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">bv
</span><span class="hs-number">0</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779186"><span class="hs-identifier hs-var">distance'</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779186"><span class="hs-identifier hs-var">distance'</span></a></span><span>
</span><span id="line-984"></span><span>
</span><span id="line-985"></span><span id="local-6989586621680780198"><span class="annot"><a href="GHC.Utils.Misc.html#sizedComplement"><span class="hs-identifier hs-type">sizedComplement</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780198"><span class="hs-identifier hs-type">bv</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780198"><span class="hs-identifier hs-type">bv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780198"><span class="hs-identifier hs-type">bv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780198"><span class="hs-identifier hs-type">bv</span></a></span></span><span>
</span><span id="line-986"></span><span id="sizedComplement"><span class="annot"><span class="annottext">sizedComplement :: forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="GHC.Utils.Misc.html#sizedComplement"><span class="hs-identifier hs-var hs-var">sizedComplement</span></a></span></span><span> </span><span id="local-6989586621680779178"><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779178"><span class="hs-identifier hs-var">vector_mask</span></a></span></span><span> </span><span id="local-6989586621680779177"><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779177"><span class="hs-identifier hs-var">vect</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779178"><span class="hs-identifier hs-var">vector_mask</span></a></span><span> </span><span class="annot"><span class="annottext">bv -&gt; bv -&gt; bv
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#xor"><span class="hs-operator hs-var">`xor`</span></a></span><span> </span><span class="annot"><span class="annottext">bv
</span><a href="#local-6989586621680779177"><span class="hs-identifier hs-var">vect</span></a></span><span>
</span><span id="line-987"></span><span>
</span><span id="line-988"></span><span id="local-6989586621680780207"><span class="annot"><a href="GHC.Utils.Misc.html#matchVectors"><span class="hs-identifier hs-type">matchVectors</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780207"><span class="hs-identifier hs-type">bv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Num.html#Num"><span class="hs-identifier hs-type">Num</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780207"><span class="hs-identifier hs-type">bv</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../containers/src/Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IM.IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780207"><span class="hs-identifier hs-type">bv</span></a></span></span><span>
</span><span id="line-989"></span><span id="matchVectors"><span class="annot"><span class="annottext">matchVectors :: forall bv. (Bits bv, Num bv) =&gt; String -&gt; IntMap bv
</span><a href="GHC.Utils.Misc.html#matchVectors"><span class="hs-identifier hs-var hs-var">matchVectors</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int, IntMap bv) -&gt; IntMap bv
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">((Int, IntMap bv) -&gt; IntMap bv)
-&gt; (String -&gt; (Int, IntMap bv)) -&gt; String -&gt; IntMap bv
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">((Int, IntMap bv) -&gt; Char -&gt; (Int, IntMap bv))
-&gt; (Int, IntMap bv) -&gt; String -&gt; (Int, IntMap bv)
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">(Int, IntMap bv) -&gt; Char -&gt; (Int, IntMap bv)
forall {a} {a}.
(Bits a, Integral a, Num a) =&gt;
(a, IntMap a) -&gt; Char -&gt; (a, IntMap a)
</span><a href="#local-6989586621680779170"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IntMap bv
forall a. IntMap a
</span><a href="../../containers/src/Data.IntMap.Internal.html#empty"><span class="hs-identifier hs-var">IM.empty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-990"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-991"></span><span>    </span><span id="local-6989586621680779170"><span class="annot"><span class="annottext">go :: (a, IntMap a) -&gt; Char -&gt; (a, IntMap a)
</span><a href="#local-6989586621680779170"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779161"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779161"><span class="hs-identifier hs-var">ix</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779160"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621680779160"><span class="hs-identifier hs-var">im</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680779159"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779159"><span class="hs-identifier hs-var">char</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680779156"><span class="annot"><span class="annottext">ix' :: a
</span><a href="#local-6989586621680779156"><span class="hs-identifier hs-var hs-var">ix'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779161"><span class="hs-identifier hs-var">ix</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span>
</span><span id="line-992"></span><span>                           </span><span id="local-6989586621680779151"><span class="annot"><span class="annottext">im' :: IntMap a
</span><a href="#local-6989586621680779151"><span class="hs-identifier hs-var hs-var">im'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; Int -&gt; a -&gt; IntMap a -&gt; IntMap a
forall a. (a -&gt; a -&gt; a) -&gt; Int -&gt; a -&gt; IntMap a -&gt; IntMap a
</span><a href="../../containers/src/Data.IntMap.Internal.html#insertWith"><span class="hs-identifier hs-var">IM.insertWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%7C."><span class="hs-operator hs-var">(.|.)</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="../../base/src/GHC.Base.html#ord"><span class="hs-identifier hs-var">ord</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779159"><span class="hs-identifier hs-var">char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Real.html#%5E"><span class="hs-operator hs-var">^</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779161"><span class="hs-identifier hs-var">ix</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621680779160"><span class="hs-identifier hs-var">im</span></a></span><span>
</span><span id="line-993"></span><span>                       </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">a -&gt; (a, IntMap a) -&gt; (a, IntMap a)
</span><span class="hs-identifier hs-var">seq</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779156"><span class="hs-identifier hs-var">ix'</span></a></span><span> </span><span class="annot"><span class="annottext">((a, IntMap a) -&gt; (a, IntMap a)) -&gt; (a, IntMap a) -&gt; (a, IntMap a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; (a, IntMap a) -&gt; (a, IntMap a)
</span><span class="hs-identifier hs-var">seq</span></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621680779151"><span class="hs-identifier hs-var">im'</span></a></span><span> </span><span class="annot"><span class="annottext">((a, IntMap a) -&gt; (a, IntMap a)) -&gt; (a, IntMap a) -&gt; (a, IntMap a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779156"><span class="hs-identifier hs-var">ix'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621680779151"><span class="hs-identifier hs-var">im'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-994"></span><span>
</span><span id="line-995"></span><span class="hs-pragma">{-# SPECIALIZE INLINE</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistance%27"><span class="hs-pragma hs-type">restrictedDamerauLevenshteinDistance'</span></a></span><span>
</span><span id="line-996"></span><span>                      </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Int</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Int</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-pragma hs-type">String</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-pragma hs-type">String</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Int</span></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-997"></span><span class="hs-pragma">{-# SPECIALIZE INLINE</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistance%27"><span class="hs-pragma hs-type">restrictedDamerauLevenshteinDistance'</span></a></span><span>
</span><span id="line-998"></span><span>                      </span><span class="hs-pragma">::</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Int</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Int</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-pragma hs-type">String</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-pragma hs-type">String</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Int</span></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-999"></span><span>
</span><span id="line-1000"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistanceWorker"><span class="hs-pragma hs-type">restrictedDamerauLevenshteinDistanceWorker</span></a></span><span>
</span><span id="line-1001"></span><span>               </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../containers/src/Data.IntMap.Internal.html#IntMap"><span class="hs-pragma hs-type">IM.IntMap</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span>
</span><span id="line-1002"></span><span>               </span><span class="hs-pragma">-&gt;</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Int</span></span><span class="hs-pragma">)</span><span>
</span><span id="line-1003"></span><span>               </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Char</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Int</span></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1004"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistanceWorker"><span class="hs-pragma hs-type">restrictedDamerauLevenshteinDistanceWorker</span></a></span><span>
</span><span id="line-1005"></span><span>               </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../containers/src/Data.IntMap.Internal.html#IntMap"><span class="hs-pragma hs-type">IM.IntMap</span></a></span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span>
</span><span id="line-1006"></span><span>               </span><span class="hs-pragma">-&gt;</span><span> </span><span class="hs-pragma">(</span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span class="hs-pragma">,</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span class="hs-pragma">,</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span class="hs-pragma">,</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span class="hs-pragma">,</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Int</span></span><span class="hs-pragma">)</span><span>
</span><span id="line-1007"></span><span>               </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Char</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="hs-pragma">(</span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span class="hs-pragma">,</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span class="hs-pragma">,</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span class="hs-pragma">,</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span class="hs-pragma">,</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Int</span></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1008"></span><span>
</span><span id="line-1009"></span><span class="hs-pragma">{-# SPECIALIZE INLINE</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#sizedComplement"><span class="hs-pragma hs-type">sizedComplement</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1010"></span><span class="hs-pragma">{-# SPECIALIZE INLINE</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#sizedComplement"><span class="hs-pragma hs-type">sizedComplement</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1011"></span><span>
</span><span id="line-1012"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#matchVectors"><span class="hs-pragma hs-type">matchVectors</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-pragma hs-type">String</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../containers/src/Data.IntMap.Internal.html#IntMap"><span class="hs-pragma hs-type">IM.IntMap</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1013"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#matchVectors"><span class="hs-pragma hs-type">matchVectors</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-pragma hs-type">String</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../containers/src/Data.IntMap.Internal.html#IntMap"><span class="hs-pragma hs-type">IM.IntMap</span></a></span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1014"></span><span>
</span><span id="line-1015"></span><span class="annot"><a href="GHC.Utils.Misc.html#fuzzyMatch"><span class="hs-identifier hs-type">fuzzyMatch</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1016"></span><span id="fuzzyMatch"><span class="annot"><span class="annottext">fuzzyMatch :: String -&gt; [String] -&gt; [String]
</span><a href="GHC.Utils.Misc.html#fuzzyMatch"><span class="hs-identifier hs-var hs-var">fuzzyMatch</span></a></span></span><span> </span><span id="local-6989586621680779149"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779149"><span class="hs-identifier hs-var">key</span></a></span></span><span> </span><span id="local-6989586621680779148"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680779148"><span class="hs-identifier hs-var">vals</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [(String, String)] -&gt; [String]
forall a. String -&gt; [(String, a)] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#fuzzyLookup"><span class="hs-identifier hs-var">fuzzyLookup</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779149"><span class="hs-identifier hs-var">key</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779147"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779147"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621680779147"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779147"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680779148"><span class="hs-identifier hs-var">vals</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1017"></span><span>
</span><span id="line-1018"></span><span class="hs-comment">-- | Search for possible matches to the users input in the given list,</span><span>
</span><span id="line-1019"></span><span class="hs-comment">-- returning a small number of ranked results</span><span>
</span><span id="line-1020"></span><span id="local-6989586621680780187"><span class="annot"><a href="GHC.Utils.Misc.html#fuzzyLookup"><span class="hs-identifier hs-type">fuzzyLookup</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680780187"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780187"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-1021"></span><span id="fuzzyLookup"><span class="annot"><span class="annottext">fuzzyLookup :: forall a. String -&gt; [(String, a)] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#fuzzyLookup"><span class="hs-identifier hs-var hs-var">fuzzyLookup</span></a></span></span><span> </span><span id="local-6989586621680779144"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779144"><span class="hs-identifier hs-var">user_entered</span></a></span></span><span> </span><span id="local-6989586621680779143"><span class="annot"><span class="annottext">[(String, a)]
</span><a href="#local-6989586621680779143"><span class="hs-identifier hs-var">possibilites</span></a></span></span><span>
</span><span id="line-1022"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((a, Int) -&gt; a) -&gt; [(a, Int)] -&gt; [a]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(a, Int) -&gt; a
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">([(a, Int)] -&gt; [a]) -&gt; [(a, Int)] -&gt; [a]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; [(a, Int)] -&gt; [(a, Int)]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#take"><span class="hs-identifier hs-var">take</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779141"><span class="hs-identifier hs-var">mAX_RESULTS</span></a></span><span> </span><span class="annot"><span class="annottext">([(a, Int)] -&gt; [(a, Int)]) -&gt; [(a, Int)] -&gt; [(a, Int)]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">((a, Int) -&gt; (a, Int) -&gt; Ordering) -&gt; [(a, Int)] -&gt; [(a, Int)]
forall a. (a -&gt; a -&gt; Ordering) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#sortBy"><span class="hs-identifier hs-var">sortBy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((a, Int) -&gt; Int) -&gt; (a, Int) -&gt; (a, Int) -&gt; Ordering
forall a b. Ord a =&gt; (b -&gt; a) -&gt; b -&gt; b -&gt; Ordering
</span><a href="../../base/src/Data.Ord.html#comparing"><span class="hs-identifier hs-var">comparing</span></a></span><span> </span><span class="annot"><span class="annottext">(a, Int) -&gt; Int
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1023"></span><span>    </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779139"><span class="hs-identifier hs-var">poss_val</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779138"><span class="hs-identifier hs-var">distance</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779137"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779137"><span class="hs-identifier hs-var">poss_str</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779139"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779139"><span class="hs-identifier hs-var">poss_val</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(String, a)]
</span><a href="#local-6989586621680779143"><span class="hs-identifier hs-var">possibilites</span></a></span><span>
</span><span id="line-1024"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680779138"><span class="annot"><span class="annottext">distance :: Int
</span><a href="#local-6989586621680779138"><span class="hs-identifier hs-var hs-var">distance</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Int
</span><a href="GHC.Utils.Misc.html#restrictedDamerauLevenshteinDistance"><span class="hs-identifier hs-var">restrictedDamerauLevenshteinDistance</span></a></span><span>
</span><span id="line-1025"></span><span>                                            </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779137"><span class="hs-identifier hs-var">poss_str</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779144"><span class="hs-identifier hs-var">user_entered</span></a></span><span>
</span><span id="line-1026"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779138"><span class="hs-identifier hs-var">distance</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779136"><span class="hs-identifier hs-var">fuzzy_threshold</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1027"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1028"></span><span>    </span><span class="hs-comment">-- Work out an appropriate match threshold:</span><span>
</span><span id="line-1029"></span><span>    </span><span class="hs-comment">-- We report a candidate if its edit distance is &lt;= the threshold,</span><span>
</span><span id="line-1030"></span><span>    </span><span class="hs-comment">-- The threshold is set to about a quarter of the # of characters the user entered</span><span>
</span><span id="line-1031"></span><span>    </span><span class="hs-comment">--   Length    Threshold</span><span>
</span><span id="line-1032"></span><span>    </span><span class="hs-comment">--     1         0          -- Don't suggest *any* candidates</span><span>
</span><span id="line-1033"></span><span>    </span><span class="hs-comment">--     2         1          -- for single-char identifiers</span><span>
</span><span id="line-1034"></span><span>    </span><span class="hs-comment">--     3         1</span><span>
</span><span id="line-1035"></span><span>    </span><span class="hs-comment">--     4         1</span><span>
</span><span id="line-1036"></span><span>    </span><span class="hs-comment">--     5         1</span><span>
</span><span id="line-1037"></span><span>    </span><span class="hs-comment">--     6         2</span><span>
</span><span id="line-1038"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-1039"></span><span>    </span><span id="local-6989586621680779136"><span class="annot"><span class="annottext">fuzzy_threshold :: Int
</span><a href="#local-6989586621680779136"><span class="hs-identifier hs-var hs-var">fuzzy_threshold</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Rational -&gt; Int
forall a b. (RealFrac a, Integral b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#truncate"><span class="hs-identifier hs-var">truncate</span></a></span><span> </span><span class="annot"><span class="annottext">(Rational -&gt; Int) -&gt; Rational -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Rational
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779144"><span class="hs-identifier hs-var">user_entered</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Rational -&gt; Rational -&gt; Rational
forall a. Fractional a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#%2F"><span class="hs-operator hs-var">/</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Rational
</span><span class="hs-number">4</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Real.html#Rational"><span class="hs-identifier hs-type">Rational</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1040"></span><span>    </span><span id="local-6989586621680779141"><span class="annot"><span class="annottext">mAX_RESULTS :: Int
</span><a href="#local-6989586621680779141"><span class="hs-identifier hs-var hs-var">mAX_RESULTS</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span>
</span><span id="line-1041"></span><span>
</span><span id="line-1042"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection[Utils-pairs]{Pairs}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-1049"></span><span>
</span><span id="line-1050"></span><span id="local-6989586621680780170"><span id="local-6989586621680780171"><span id="local-6989586621680780172"><span class="annot"><a href="GHC.Utils.Misc.html#unzipWith"><span class="hs-identifier hs-type">unzipWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780172"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780171"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780170"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680780172"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680780171"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780170"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span></span></span></span><span>
</span><span id="line-1051"></span><span id="unzipWith"><span class="annot"><span class="annottext">unzipWith :: forall a b c. (a -&gt; b -&gt; c) -&gt; [(a, b)] -&gt; [c]
</span><a href="GHC.Utils.Misc.html#unzipWith"><span class="hs-identifier hs-var hs-var">unzipWith</span></a></span></span><span> </span><span id="local-6989586621680779121"><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621680779121"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680779120"><span class="annot"><span class="annottext">[(a, b)]
</span><a href="#local-6989586621680779120"><span class="hs-identifier hs-var">pairs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((a, b) -&gt; c) -&gt; [(a, b)] -&gt; [c]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779119"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779119"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779118"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779118"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621680779121"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779119"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779118"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(a, b)]
</span><a href="#local-6989586621680779120"><span class="hs-identifier hs-var">pairs</span></a></span><span>
</span><span id="line-1052"></span><span>
</span><span id="line-1053"></span><span id="local-6989586621680780165"><span id="local-6989586621680780166"><span class="annot"><a href="GHC.Utils.Misc.html#seqList"><span class="hs-identifier hs-type">seqList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780166"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780165"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780165"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-1054"></span><span id="seqList"><span class="annot"><span class="annottext">seqList :: forall a b. [a] -&gt; b -&gt; b
</span><a href="GHC.Utils.Misc.html#seqList"><span class="hs-identifier hs-var hs-var">seqList</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621680779117"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779117"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779117"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-1055"></span><span class="annot"><a href="GHC.Utils.Misc.html#seqList"><span class="hs-identifier hs-var">seqList</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779116"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779116"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779115"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779115"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680779114"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779114"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779116"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; b -&gt; b
forall a b. [a] -&gt; b -&gt; b
</span><a href="GHC.Utils.Misc.html#seqList"><span class="hs-identifier hs-var">seqList</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779115"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779114"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-1056"></span><span>
</span><span id="line-1057"></span><span id="local-6989586621680779112"><span id="local-6989586621680779113"><span class="annot"><a href="GHC.Utils.Misc.html#strictMap"><span class="hs-identifier hs-type">strictMap</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680779113"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680779112"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779113"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680779112"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-1058"></span><span id="strictMap"><span class="annot"><span class="annottext">strictMap :: forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="GHC.Utils.Misc.html#strictMap"><span class="hs-identifier hs-var hs-var">strictMap</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1059"></span><span class="annot"><a href="GHC.Utils.Misc.html#strictMap"><span class="hs-identifier hs-var">strictMap</span></a></span><span> </span><span id="local-6989586621680779111"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680779111"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779110"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779110"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680779109"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779109"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1060"></span><span>  </span><span class="hs-keyword">let</span><span>
</span><span id="line-1061"></span><span>    </span><span class="hs-glyph">!</span><span id="local-6989586621680779108"><span class="annot"><span class="annottext">x' :: b
</span><a href="#local-6989586621680779108"><span class="hs-identifier hs-var hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680779111"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779110"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1062"></span><span>    </span><span class="hs-glyph">!</span><span id="local-6989586621680779107"><span class="annot"><span class="annottext">xs' :: [b]
</span><a href="#local-6989586621680779107"><span class="hs-identifier hs-var hs-var">xs'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; [a] -&gt; [b]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="GHC.Utils.Misc.html#strictMap"><span class="hs-identifier hs-var">strictMap</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680779111"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779109"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1063"></span><span>  </span><span class="hs-keyword">in</span><span>
</span><span id="line-1064"></span><span>    </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680779108"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; [b] -&gt; [b]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680779107"><span class="hs-identifier hs-var">xs'</span></a></span><span>
</span><span id="line-1065"></span><span>
</span><span id="line-1066"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                        Globals and the RTS
*                                                                      *
************************************************************************

When a plugin is loaded, it currently gets linked against a *newly
loaded* copy of the GHC package. This would not be a problem, except
that the new copy has its own mutable state that is not shared with
that state that has already been initialized by the original GHC
package.

(Note that if the GHC executable was dynamically linked this
wouldn't be a problem, because we could share the GHC library it
links to; this is only a problem if DYNAMIC_GHC_PROGRAMS=NO.)

The solution is to make use of @sharedCAF@ through @sharedGlobal@
for globals that are shared between multiple copies of ghc packages.
-}</span><span>
</span><span id="line-1086"></span><span>
</span><span id="line-1087"></span><span class="hs-comment">-- Global variables:</span><span>
</span><span id="line-1088"></span><span>
</span><span id="line-1089"></span><span id="local-6989586621680780160"><span class="annot"><a href="GHC.Utils.Misc.html#global"><span class="hs-identifier hs-type">global</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680780160"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780160"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1090"></span><span id="global"><span class="annot"><span class="annottext">global :: forall a. a -&gt; IORef a
</span><a href="GHC.Utils.Misc.html#global"><span class="hs-identifier hs-var hs-var">global</span></a></span></span><span> </span><span id="local-6989586621680779106"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779106"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO (IORef a) -&gt; IORef a
forall a. IO a -&gt; a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafePerformIO"><span class="hs-identifier hs-var">unsafePerformIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; IO (IORef a)
forall a. a -&gt; IO (IORef a)
</span><a href="../../base/src/GHC.IORef.html#newIORef"><span class="hs-identifier hs-var">newIORef</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779106"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1091"></span><span>
</span><span id="line-1092"></span><span id="local-6989586621680780155"><span class="annot"><a href="GHC.Utils.Misc.html#consIORef"><span class="hs-identifier hs-type">consIORef</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680780155"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780155"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-1093"></span><span id="consIORef"><span class="annot"><span class="annottext">consIORef :: forall a. IORef [a] -&gt; a -&gt; IO ()
</span><a href="GHC.Utils.Misc.html#consIORef"><span class="hs-identifier hs-var hs-var">consIORef</span></a></span></span><span> </span><span id="local-6989586621680779105"><span class="annot"><span class="annottext">IORef [a]
</span><a href="#local-6989586621680779105"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span id="local-6989586621680779104"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779104"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1094"></span><span>  </span><span class="annot"><span class="annottext">IORef [a] -&gt; ([a] -&gt; ([a], ())) -&gt; IO ()
forall a b. IORef a -&gt; (a -&gt; (a, b)) -&gt; IO b
</span><a href="../../base/src/GHC.IORef.html#atomicModifyIORef%27"><span class="hs-identifier hs-var">atomicModifyIORef'</span></a></span><span> </span><span class="annot"><span class="annottext">IORef [a]
</span><a href="#local-6989586621680779105"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680779103"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779103"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779104"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680779103"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1095"></span><span>
</span><span id="line-1096"></span><span id="local-6989586621680780151"><span class="annot"><a href="GHC.Utils.Misc.html#globalM"><span class="hs-identifier hs-type">globalM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621680780151"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780151"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1097"></span><span id="globalM"><span class="annot"><span class="annottext">globalM :: forall a. IO a -&gt; IORef a
</span><a href="GHC.Utils.Misc.html#globalM"><span class="hs-identifier hs-var hs-var">globalM</span></a></span></span><span> </span><span id="local-6989586621680779101"><span class="annot"><span class="annottext">IO a
</span><a href="#local-6989586621680779101"><span class="hs-identifier hs-var">ma</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO (IORef a) -&gt; IORef a
forall a. IO a -&gt; a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafePerformIO"><span class="hs-identifier hs-var">unsafePerformIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IO a
</span><a href="#local-6989586621680779101"><span class="hs-identifier hs-var">ma</span></a></span><span> </span><span class="annot"><span class="annottext">IO a -&gt; (a -&gt; IO (IORef a)) -&gt; IO (IORef a)
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; IO (IORef a)
forall a. a -&gt; IO (IORef a)
</span><a href="../../base/src/GHC.IORef.html#newIORef"><span class="hs-identifier hs-var">newIORef</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1098"></span><span>
</span><span id="line-1099"></span><span class="hs-comment">-- Shared global variables:</span><span>
</span><span id="line-1100"></span><span>
</span><span id="line-1101"></span><span id="local-6989586621680780147"><span class="annot"><a href="GHC.Utils.Misc.html#sharedGlobal"><span class="hs-identifier hs-type">sharedGlobal</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680780147"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780147"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780147"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780147"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1102"></span><span id="sharedGlobal"><span class="annot"><span class="annottext">sharedGlobal :: forall a. a -&gt; (Ptr (IORef a) -&gt; IO (Ptr (IORef a))) -&gt; IORef a
</span><a href="GHC.Utils.Misc.html#sharedGlobal"><span class="hs-identifier hs-var hs-var">sharedGlobal</span></a></span></span><span> </span><span id="local-6989586621680779099"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779099"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621680779098"><span class="annot"><span class="annottext">Ptr (IORef a) -&gt; IO (Ptr (IORef a))
</span><a href="#local-6989586621680779098"><span class="hs-identifier hs-var">get_or_set</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO (IORef a) -&gt; IORef a
forall a. IO a -&gt; a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafePerformIO"><span class="hs-identifier hs-var">unsafePerformIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (IORef a) -&gt; IORef a) -&gt; IO (IORef a) -&gt; IORef a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1103"></span><span>  </span><span class="annot"><span class="annottext">a -&gt; IO (IORef a)
forall a. a -&gt; IO (IORef a)
</span><a href="../../base/src/GHC.IORef.html#newIORef"><span class="hs-identifier hs-var">newIORef</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680779099"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">IO (IORef a) -&gt; (IORef a -&gt; IO (IORef a)) -&gt; IO (IORef a)
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">(IORef a -&gt; (Ptr (IORef a) -&gt; IO (Ptr (IORef a))) -&gt; IO (IORef a))
-&gt; (Ptr (IORef a) -&gt; IO (Ptr (IORef a))) -&gt; IORef a -&gt; IO (IORef a)
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">IORef a -&gt; (Ptr (IORef a) -&gt; IO (Ptr (IORef a))) -&gt; IO (IORef a)
forall a. a -&gt; (Ptr a -&gt; IO (Ptr a)) -&gt; IO a
</span><a href="../../base/src/GHC.Conc.Sync.html#sharedCAF"><span class="hs-identifier hs-var">sharedCAF</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr (IORef a) -&gt; IO (Ptr (IORef a))
</span><a href="#local-6989586621680779098"><span class="hs-identifier hs-var">get_or_set</span></a></span><span>
</span><span id="line-1104"></span><span>
</span><span id="line-1105"></span><span id="local-6989586621680780141"><span class="annot"><a href="GHC.Utils.Misc.html#sharedGlobalM"><span class="hs-identifier hs-type">sharedGlobalM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621680780141"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780141"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780141"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780141"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1106"></span><span id="sharedGlobalM"><span class="annot"><span class="annottext">sharedGlobalM :: forall a. IO a -&gt; (Ptr (IORef a) -&gt; IO (Ptr (IORef a))) -&gt; IORef a
</span><a href="GHC.Utils.Misc.html#sharedGlobalM"><span class="hs-identifier hs-var hs-var">sharedGlobalM</span></a></span></span><span> </span><span id="local-6989586621680779094"><span class="annot"><span class="annottext">IO a
</span><a href="#local-6989586621680779094"><span class="hs-identifier hs-var">ma</span></a></span></span><span> </span><span id="local-6989586621680779093"><span class="annot"><span class="annottext">Ptr (IORef a) -&gt; IO (Ptr (IORef a))
</span><a href="#local-6989586621680779093"><span class="hs-identifier hs-var">get_or_set</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO (IORef a) -&gt; IORef a
forall a. IO a -&gt; a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafePerformIO"><span class="hs-identifier hs-var">unsafePerformIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (IORef a) -&gt; IORef a) -&gt; IO (IORef a) -&gt; IORef a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1107"></span><span>  </span><span class="annot"><span class="annottext">IO a
</span><a href="#local-6989586621680779094"><span class="hs-identifier hs-var">ma</span></a></span><span> </span><span class="annot"><span class="annottext">IO a -&gt; (a -&gt; IO (IORef a)) -&gt; IO (IORef a)
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; IO (IORef a)
forall a. a -&gt; IO (IORef a)
</span><a href="../../base/src/GHC.IORef.html#newIORef"><span class="hs-identifier hs-var">newIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IO (IORef a) -&gt; (IORef a -&gt; IO (IORef a)) -&gt; IO (IORef a)
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">(IORef a -&gt; (Ptr (IORef a) -&gt; IO (Ptr (IORef a))) -&gt; IO (IORef a))
-&gt; (Ptr (IORef a) -&gt; IO (Ptr (IORef a))) -&gt; IORef a -&gt; IO (IORef a)
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">IORef a -&gt; (Ptr (IORef a) -&gt; IO (Ptr (IORef a))) -&gt; IO (IORef a)
forall a. a -&gt; (Ptr a -&gt; IO (Ptr a)) -&gt; IO a
</span><a href="../../base/src/GHC.Conc.Sync.html#sharedCAF"><span class="hs-identifier hs-var">sharedCAF</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr (IORef a) -&gt; IO (Ptr (IORef a))
</span><a href="#local-6989586621680779093"><span class="hs-identifier hs-var">get_or_set</span></a></span><span>
</span><span id="line-1108"></span><span>
</span><span id="line-1109"></span><span class="hs-comment">-- Module names:</span><span>
</span><span id="line-1110"></span><span>
</span><span id="line-1111"></span><span class="annot"><a href="GHC.Utils.Misc.html#looksLikeModuleName"><span class="hs-identifier hs-type">looksLikeModuleName</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1112"></span><span id="looksLikeModuleName"><span class="annot"><span class="annottext">looksLikeModuleName :: String -&gt; Bool
</span><a href="GHC.Utils.Misc.html#looksLikeModuleName"><span class="hs-identifier hs-var hs-var">looksLikeModuleName</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1113"></span><span class="annot"><a href="GHC.Utils.Misc.html#looksLikeModuleName"><span class="hs-identifier hs-var">looksLikeModuleName</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779092"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779092"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779091"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779091"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isUpper"><span class="hs-identifier hs-var">isUpper</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779092"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; Bool
</span><a href="#local-6989586621680779090"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779091"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-1114"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680779090"><span class="annot"><span class="annottext">go :: String -&gt; Bool
</span><a href="#local-6989586621680779090"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1115"></span><span>        </span><span class="annot"><a href="#local-6989586621680779090"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'.'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779087"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779087"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Bool
</span><a href="GHC.Utils.Misc.html#looksLikeModuleName"><span class="hs-identifier hs-var">looksLikeModuleName</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779087"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-1116"></span><span>        </span><span class="annot"><a href="#local-6989586621680779090"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779086"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779086"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779085"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779085"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isAlphaNum"><span class="hs-identifier hs-var">isAlphaNum</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779086"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779086"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'_'</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779086"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\''</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; Bool
</span><a href="#local-6989586621680779090"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779085"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-1117"></span><span>
</span><span id="line-1118"></span><span class="hs-comment">-- Similar to 'parse' for Distribution.Package.PackageName,</span><span>
</span><span id="line-1119"></span><span class="hs-comment">-- but we don't want to depend on Cabal.</span><span>
</span><span id="line-1120"></span><span class="annot"><a href="GHC.Utils.Misc.html#looksLikePackageName"><span class="hs-identifier hs-type">looksLikePackageName</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1121"></span><span id="looksLikePackageName"><span class="annot"><span class="annottext">looksLikePackageName :: String -&gt; Bool
</span><a href="GHC.Utils.Misc.html#looksLikePackageName"><span class="hs-identifier hs-var hs-var">looksLikePackageName</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; Bool) -&gt; [String] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isAlphaNum"><span class="hs-identifier hs-var">isAlphaNum</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; Bool) -&gt; (String -&gt; Bool) -&gt; String -&gt; Bool
forall (f :: * -&gt; *). Applicative f =&gt; f Bool -&gt; f Bool -&gt; f Bool
</span><a href="GHC.Utils.Misc.html#%3C%26%26%3E"><span class="hs-operator hs-var">&lt;&amp;&amp;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (String -&gt; Bool) -&gt; String -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isDigit"><span class="hs-identifier hs-var">isDigit</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([String] -&gt; Bool) -&gt; (String -&gt; [String]) -&gt; String -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; [String]
</span><a href="GHC.Utils.Misc.html#split"><span class="hs-identifier hs-var">split</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span>
</span><span id="line-1122"></span><span>
</span><span id="line-1123"></span><span class="hs-comment">{-
Akin to @Prelude.words@, but acts like the Bourne shell, treating
quoted strings as Haskell Strings, and also parses Haskell [String]
syntax.
-}</span><span>
</span><span id="line-1128"></span><span>
</span><span id="line-1129"></span><span class="annot"><a href="GHC.Utils.Misc.html#getCmd"><span class="hs-identifier hs-type">getCmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>             </span><span class="hs-comment">-- Error</span><span>
</span><span id="line-1130"></span><span>                           </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- (Cmd, Rest)</span><span>
</span><span id="line-1131"></span><span id="getCmd"><span class="annot"><span class="annottext">getCmd :: String -&gt; Either String (String, String)
</span><a href="GHC.Utils.Misc.html#getCmd"><span class="hs-identifier hs-var hs-var">getCmd</span></a></span></span><span> </span><span id="local-6989586621680779084"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779084"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#break"><span class="hs-identifier hs-var">break</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; (String, String)) -&gt; String -&gt; (String, String)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; String
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#dropWhile"><span class="hs-identifier hs-var">dropWhile</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779084"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1132"></span><span>           </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String (String, String)
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Couldn't find command in &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779084"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1133"></span><span>           </span><span id="local-6989586621680779082"><span class="annot"><span class="annottext">(String, String)
</span><a href="#local-6989586621680779082"><span class="hs-identifier hs-var">res</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(String, String) -&gt; Either String (String, String)
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="annot"><span class="annottext">(String, String)
</span><a href="#local-6989586621680779082"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1134"></span><span>
</span><span id="line-1135"></span><span class="annot"><a href="GHC.Utils.Misc.html#toCmdArgs"><span class="hs-identifier hs-type">toCmdArgs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>             </span><span class="hs-comment">-- Error</span><span>
</span><span id="line-1136"></span><span>                              </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- (Cmd, Args)</span><span>
</span><span id="line-1137"></span><span id="toCmdArgs"><span class="annot"><span class="annottext">toCmdArgs :: String -&gt; Either String (String, [String])
</span><a href="GHC.Utils.Misc.html#toCmdArgs"><span class="hs-identifier hs-var hs-var">toCmdArgs</span></a></span></span><span> </span><span id="local-6989586621680779081"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779081"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String (String, String)
</span><a href="GHC.Utils.Misc.html#getCmd"><span class="hs-identifier hs-var">getCmd</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779081"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1138"></span><span>              </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span id="local-6989586621680779080"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779080"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String (String, [String])
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779080"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-1139"></span><span>              </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779079"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779079"><span class="hs-identifier hs-var">cmd</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779078"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779078"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String [String]
</span><a href="GHC.Utils.Misc.html#toArgs"><span class="hs-identifier hs-var">toArgs</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779078"><span class="hs-identifier hs-var">s'</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1140"></span><span>                                 </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span id="local-6989586621680779077"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779077"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String (String, [String])
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779077"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-1141"></span><span>                                 </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621680779076"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680779076"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(String, [String]) -&gt; Either String (String, [String])
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779079"><span class="hs-identifier hs-var">cmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680779076"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1142"></span><span>
</span><span id="line-1143"></span><span class="annot"><a href="GHC.Utils.Misc.html#toArgs"><span class="hs-identifier hs-type">toArgs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>   </span><span class="hs-comment">-- Error</span><span>
</span><span id="line-1144"></span><span>                           </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- Args</span><span>
</span><span id="line-1145"></span><span id="toArgs"><span class="annot"><span class="annottext">toArgs :: String -&gt; Either String [String]
</span><a href="GHC.Utils.Misc.html#toArgs"><span class="hs-identifier hs-var hs-var">toArgs</span></a></span></span><span> </span><span id="local-6989586621680779075"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779075"><span class="hs-identifier hs-var">str</span></a></span></span><span>
</span><span id="line-1146"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; String
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#dropWhile"><span class="hs-identifier hs-var">dropWhile</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779075"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1147"></span><span>      </span><span id="local-6989586621680779074"><span class="annot"><span class="annottext">s :: String
</span><a href="#local-6989586621680779074"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'['</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ReadS [String]
forall a. Read a =&gt; ReadS a
</span><a href="../../base/src/Text.Read.html#reads"><span class="hs-identifier hs-var">reads</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779074"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1148"></span><span>                   </span><span class="hs-special">[</span><span class="hs-special">(</span><span id="local-6989586621680779072"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680779072"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779071"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779071"><span class="hs-identifier hs-var">spaces</span></a></span></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1149"></span><span>                    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779071"><span class="hs-identifier hs-var">spaces</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1150"></span><span>                       </span><span class="annot"><span class="annottext">[String] -&gt; Either String [String]
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680779072"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-1151"></span><span>                   </span><span class="annot"><span class="annottext">[([String], String)]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1152"></span><span>                       </span><span class="annot"><span class="annottext">String -&gt; Either String [String]
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Couldn't read &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779075"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; as [String]&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1153"></span><span>      </span><span id="local-6989586621680779070"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779070"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String [String]
</span><a href="#local-6989586621680779069"><span class="hs-identifier hs-var">toArgs'</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779070"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1154"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1155"></span><span>  </span><span class="annot"><a href="#local-6989586621680779069"><span class="hs-identifier hs-type">toArgs'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1156"></span><span>  </span><span class="hs-comment">-- Remove outer quotes:</span><span>
</span><span id="line-1157"></span><span>  </span><span class="hs-comment">-- &gt; toArgs' &quot;\&quot;foo\&quot; \&quot;bar baz\&quot;&quot;</span><span>
</span><span id="line-1158"></span><span>  </span><span class="hs-comment">-- Right [&quot;foo&quot;, &quot;bar baz&quot;]</span><span>
</span><span id="line-1159"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-1160"></span><span>  </span><span class="hs-comment">-- Keep inner quotes:</span><span>
</span><span id="line-1161"></span><span>  </span><span class="hs-comment">-- &gt; toArgs' &quot;-DFOO=\&quot;bar baz\&quot;&quot;</span><span>
</span><span id="line-1162"></span><span>  </span><span class="hs-comment">-- Right [&quot;-DFOO=\&quot;bar baz\&quot;&quot;]</span><span>
</span><span id="line-1163"></span><span>  </span><span id="local-6989586621680779069"><span class="annot"><span class="annottext">toArgs' :: String -&gt; Either String [String]
</span><a href="#local-6989586621680779069"><span class="hs-identifier hs-var hs-var">toArgs'</span></a></span></span><span> </span><span id="local-6989586621680779068"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779068"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; String
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#dropWhile"><span class="hs-identifier hs-var">dropWhile</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779068"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1164"></span><span>              </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; Either String [String]
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1165"></span><span>              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'&quot;'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1166"></span><span>                    </span><span class="hs-comment">-- readAsString removes outer quotes</span><span>
</span><span id="line-1167"></span><span>                    </span><span class="hs-special">(</span><span id="local-6989586621680779067"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779067"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779066"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779066"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String (String, String)
</span><a href="#local-6989586621680779065"><span class="hs-identifier hs-var">readAsString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779068"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1168"></span><span>                    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779067"><span class="hs-identifier hs-var">arg</span></a></span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([String] -&gt; [String])
-&gt; Either String [String] -&gt; Either String [String]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-operator hs-var">`fmap`</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String [String]
</span><a href="#local-6989586621680779069"><span class="hs-identifier hs-var">toArgs'</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779066"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-1169"></span><span>              </span><span id="local-6989586621680779064"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779064"><span class="hs-identifier hs-var">s'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#break"><span class="hs-identifier hs-var">break</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Char -&gt; Bool) -&gt; Char -&gt; Bool
forall (f :: * -&gt; *). Applicative f =&gt; f Bool -&gt; f Bool -&gt; f Bool
</span><a href="GHC.Utils.Misc.html#%3C%7C%7C%3E"><span class="hs-operator hs-var">&lt;||&gt;</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'&quot;'</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779064"><span class="hs-identifier hs-var">s'</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1170"></span><span>                    </span><span class="hs-special">(</span><span id="local-6989586621680779063"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779063"><span class="hs-identifier hs-var">argPart1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779062"><span class="annot"><span class="annottext">s'' :: String
</span><a href="#local-6989586621680779062"><span class="hs-identifier hs-var">s''</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'&quot;'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1171"></span><span>                        </span><span class="hs-special">(</span><span id="local-6989586621680779061"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779061"><span class="hs-identifier hs-var">argPart2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779060"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779060"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String (String, String)
</span><a href="#local-6989586621680779065"><span class="hs-identifier hs-var">readAsString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779062"><span class="hs-identifier hs-var">s''</span></a></span><span>
</span><span id="line-1172"></span><span>                        </span><span class="hs-comment">-- show argPart2 to keep inner quotes</span><span>
</span><span id="line-1173"></span><span>                        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779063"><span class="hs-identifier hs-var">argPart1</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779061"><span class="hs-identifier hs-var">argPart2</span></a></span><span class="hs-special">)</span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([String] -&gt; [String])
-&gt; Either String [String] -&gt; Either String [String]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-operator hs-var">`fmap`</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String [String]
</span><a href="#local-6989586621680779069"><span class="hs-identifier hs-var">toArgs'</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779060"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-1174"></span><span>                    </span><span class="hs-special">(</span><span id="local-6989586621680779059"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779059"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779058"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779058"><span class="hs-identifier hs-var">s''</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779059"><span class="hs-identifier hs-var">arg</span></a></span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([String] -&gt; [String])
-&gt; Either String [String] -&gt; Either String [String]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-operator hs-var">`fmap`</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String [String]
</span><a href="#local-6989586621680779069"><span class="hs-identifier hs-var">toArgs'</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779058"><span class="hs-identifier hs-var">s''</span></a></span><span>
</span><span id="line-1175"></span><span>
</span><span id="line-1176"></span><span>  </span><span class="annot"><a href="#local-6989586621680779065"><span class="hs-identifier hs-type">readAsString</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1177"></span><span>  </span><span id="local-6989586621680779065"><span class="annot"><span class="annottext">readAsString :: String -&gt; Either String (String, String)
</span><a href="#local-6989586621680779065"><span class="hs-identifier hs-var hs-var">readAsString</span></a></span></span><span> </span><span id="local-6989586621680779057"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779057"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ReadS String
forall a. Read a =&gt; ReadS a
</span><a href="../../base/src/Text.Read.html#reads"><span class="hs-identifier hs-var">reads</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779057"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1178"></span><span>                </span><span class="hs-special">[</span><span class="hs-special">(</span><span id="local-6989586621680779056"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779056"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680779055"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779055"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1179"></span><span>                    </span><span class="hs-comment">-- rest must either be [] or start with a space</span><span>
</span><span id="line-1180"></span><span>                    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; String -&gt; String
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#take"><span class="hs-identifier hs-var">take</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779055"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1181"></span><span>                    </span><span class="annot"><span class="annottext">(String, String) -&gt; Either String (String, String)
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779056"><span class="hs-identifier hs-var">arg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779055"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1182"></span><span>                </span><span class="annot"><span class="annottext">[(String, String)]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1183"></span><span>                    </span><span class="annot"><span class="annottext">String -&gt; Either String (String, String)
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Couldn't read &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779057"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; as String&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1184"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-1185"></span><span class="hs-comment">-- Integers</span><span>
</span><span id="line-1186"></span><span>
</span><span id="line-1187"></span><span class="hs-comment">-- | Determine the $\log_2$ of exact powers of 2</span><span>
</span><span id="line-1188"></span><span class="annot"><a href="GHC.Utils.Misc.html#exactLog2"><span class="hs-identifier hs-type">exactLog2</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span>
</span><span id="line-1189"></span><span id="exactLog2"><span class="annot"><span class="annottext">exactLog2 :: Integer -&gt; Maybe Integer
</span><a href="GHC.Utils.Misc.html#exactLog2"><span class="hs-identifier hs-var hs-var">exactLog2</span></a></span></span><span> </span><span id="local-6989586621680779054"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680779054"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-1190"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680779054"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span>                               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Integer
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1191"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680779054"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Integer
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int32
forall a. Bounded a =&gt; a
</span><a href="../../base/src/GHC.Enum.html#maxBound"><span class="hs-identifier hs-var">maxBound</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Integer
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1192"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621680779051"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int32 -&gt; Int32
forall bv. Bits bv =&gt; bv -&gt; bv -&gt; bv
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621680779051"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int32 -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621680779051"><span class="hs-identifier hs-var">x'</span></a></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Integer
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1193"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Maybe Integer
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779050"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1194"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-1195"></span><span>         </span><span id="local-6989586621680779051"><span class="annot"><span class="annottext">x' :: Int32
</span><a href="#local-6989586621680779051"><span class="hs-identifier hs-var hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int32
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680779054"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span>
</span><span id="line-1196"></span><span>         </span><span id="local-6989586621680779050"><span class="annot"><span class="annottext">c :: Int
</span><a href="#local-6989586621680779050"><span class="hs-identifier hs-var hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int
forall b. FiniteBits b =&gt; b -&gt; Int
</span><a href="../../base/src/Data.Bits.html#countTrailingZeros"><span class="hs-identifier hs-var">countTrailingZeros</span></a></span><span> </span><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621680779051"><span class="hs-identifier hs-var">x'</span></a></span><span>
</span><span id="line-1197"></span><span>
</span><span id="line-1198"></span><span class="hs-comment">{-
-- -----------------------------------------------------------------------------
-- Floats
-}</span><span>
</span><span id="line-1202"></span><span>
</span><span id="line-1203"></span><span class="annot"><a href="GHC.Utils.Misc.html#readRational__"><span class="hs-identifier hs-type">readRational__</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Text.ParserCombinators.ReadP.html#ReadS"><span class="hs-identifier hs-type">ReadS</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Real.html#Rational"><span class="hs-identifier hs-type">Rational</span></a></span><span> </span><span class="hs-comment">-- NB: doesn't handle leading &quot;-&quot;</span><span>
</span><span id="line-1204"></span><span id="readRational__"><span class="annot"><span class="annottext">readRational__ :: ReadS Rational
</span><a href="GHC.Utils.Misc.html#readRational__"><span class="hs-identifier hs-var hs-var">readRational__</span></a></span></span><span> </span><span id="local-6989586621680779043"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779043"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1205"></span><span>     </span><span class="hs-special">(</span><span id="local-6989586621680779042"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680779042"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680779041"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779041"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680779040"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779040"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; [(Integer, Int, String)]
forall {a}. Read a =&gt; String -&gt; [(a, Int, String)]
</span><a href="#local-6989586621680779039"><span class="hs-identifier hs-var">readFix</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779043"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1206"></span><span>     </span><span class="hs-special">(</span><span id="local-6989586621680779038"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779038"><span class="hs-identifier hs-var">k</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680779037"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779037"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; [(Int, String)]
forall {m :: * -&gt; *}. MonadFail m =&gt; String -&gt; m (Int, String)
</span><a href="#local-6989586621680779036"><span class="hs-identifier hs-var">readExp</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779040"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1207"></span><span>     </span><span class="annot"><span class="annottext">(Rational, String) -&gt; [(Rational, String)]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680779042"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Rational
forall a. Integral a =&gt; a -&gt; a -&gt; Ratio a
</span><a href="../../base/src/GHC.Real.html#%25"><span class="hs-operator hs-var">%</span></a></span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span class="annot"><span class="annottext">Rational -&gt; Rational -&gt; Rational
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Rational
</span><span class="hs-number">10</span></span><span class="annot"><span class="annottext">Rational -&gt; Int -&gt; Rational
forall a b. (Fractional a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Real.html#%5E%5E"><span class="hs-operator hs-var">^^</span></a></span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779038"><span class="hs-identifier hs-var">k</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680779041"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779037"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1208"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1209"></span><span>     </span><span id="local-6989586621680779039"><span class="annot"><span class="annottext">readFix :: String -&gt; [(a, Int, String)]
</span><a href="#local-6989586621680779039"><span class="hs-identifier hs-var hs-var">readFix</span></a></span></span><span> </span><span id="local-6989586621680779026"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779026"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1210"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680779025"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779025"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680779024"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779024"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ReadS String
</span><a href="#local-6989586621680779023"><span class="hs-identifier hs-var">lexDecDigits</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779026"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1211"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680779022"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779022"><span class="hs-identifier hs-var">ds'</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680779021"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779021"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ReadS String
forall {m :: * -&gt; *}. Monad m =&gt; String -&gt; m (String, String)
</span><a href="#local-6989586621680779020"><span class="hs-identifier hs-var">lexDotDigits</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779024"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1212"></span><span>        </span><span class="annot"><span class="annottext">(a, Int, String) -&gt; [(a, Int, String)]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; a
forall a. Read a =&gt; String -&gt; a
</span><a href="../../base/src/Text.Read.html#read"><span class="hs-identifier hs-var">read</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779025"><span class="hs-identifier hs-var">ds</span></a></span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779022"><span class="hs-identifier hs-var">ds'</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779022"><span class="hs-identifier hs-var">ds'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779021"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1213"></span><span>
</span><span id="line-1214"></span><span>     </span><span id="local-6989586621680779036"><span class="annot"><span class="annottext">readExp :: String -&gt; m (Int, String)
</span><a href="#local-6989586621680779036"><span class="hs-identifier hs-var hs-var">readExp</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680779010"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779010"><span class="hs-identifier hs-var">e</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680779009"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779009"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680779010"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;eE&quot;</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; m (Int, String)
forall {m :: * -&gt; *}. MonadFail m =&gt; String -&gt; m (Int, String)
</span><a href="#local-6989586621680779008"><span class="hs-identifier hs-var">readExp'</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779009"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1215"></span><span>     </span><span class="annot"><a href="#local-6989586621680779036"><span class="hs-identifier hs-var">readExp</span></a></span><span> </span><span id="local-6989586621680779007"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779007"><span class="hs-identifier hs-var">s</span></a></span></span><span>                     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int, String) -&gt; m (Int, String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680779007"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1216"></span><span>
</span><span id="line-1217"></span><span>     </span><span id="local-6989586621680779008"><span class="annot"><span class="annottext">readExp' :: String -&gt; m (Int, String)
</span><a href="#local-6989586621680779008"><span class="hs-identifier hs-var hs-var">readExp'</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'+'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680778998"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778998"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; m (Int, String)
forall {m :: * -&gt; *}. MonadFail m =&gt; String -&gt; m (Int, String)
</span><a href="#local-6989586621680778997"><span class="hs-identifier hs-var">readDec</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778998"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1218"></span><span>     </span><span class="annot"><a href="#local-6989586621680779008"><span class="hs-identifier hs-var">readExp'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680778996"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778996"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680778995"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680778995"><span class="hs-identifier hs-var">k</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680778994"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778994"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; m (Int, String)
forall {m :: * -&gt; *}. MonadFail m =&gt; String -&gt; m (Int, String)
</span><a href="#local-6989586621680778997"><span class="hs-identifier hs-var">readDec</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778996"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1219"></span><span>                           </span><span class="annot"><span class="annottext">(Int, String) -&gt; m (Int, String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680778995"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778994"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1220"></span><span>     </span><span class="annot"><a href="#local-6989586621680779008"><span class="hs-identifier hs-var">readExp'</span></a></span><span> </span><span id="local-6989586621680778993"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778993"><span class="hs-identifier hs-var">s</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; m (Int, String)
forall {m :: * -&gt; *}. MonadFail m =&gt; String -&gt; m (Int, String)
</span><a href="#local-6989586621680778997"><span class="hs-identifier hs-var">readDec</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778993"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1221"></span><span>
</span><span id="line-1222"></span><span>     </span><span id="local-6989586621680778997"><span class="annot"><span class="annottext">readDec :: String -&gt; m (Int, String)
</span><a href="#local-6989586621680778997"><span class="hs-identifier hs-var hs-var">readDec</span></a></span></span><span> </span><span id="local-6989586621680778982"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778982"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1223"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680778981"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778981"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680778980"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778980"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; m (String, String)
forall {m :: * -&gt; *}.
MonadFail m =&gt;
(Char -&gt; Bool) -&gt; String -&gt; m (String, String)
</span><a href="#local-6989586621680778979"><span class="hs-identifier hs-var">nonnull</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isDigit"><span class="hs-identifier hs-var">isDigit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778982"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1224"></span><span>        </span><span class="annot"><span class="annottext">(Int, String) -&gt; m (Int, String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Int -&gt; Int -&gt; Int) -&gt; [Int] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; a -&gt; a) -&gt; t a -&gt; a
</span><a href="../../base/src/Data.Foldable.html#foldl1"><span class="hs-identifier hs-var">foldl1</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680778977"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680778977"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680778976"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680778976"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680778977"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">10</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680778976"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="../../base/src/GHC.Base.html#ord"><span class="hs-identifier hs-var">ord</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778975"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="../../base/src/GHC.Base.html#ord"><span class="hs-identifier hs-var">ord</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'0'</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621680778975"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778975"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778981"><span class="hs-identifier hs-var">ds</span></a></span><span> </span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-1225"></span><span>                </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778980"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1226"></span><span>
</span><span id="line-1227"></span><span>     </span><span id="local-6989586621680779023"><span class="annot"><span class="annottext">lexDecDigits :: ReadS String
</span><a href="#local-6989586621680779023"><span class="hs-identifier hs-var hs-var">lexDecDigits</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; ReadS String
forall {m :: * -&gt; *}.
MonadFail m =&gt;
(Char -&gt; Bool) -&gt; String -&gt; m (String, String)
</span><a href="#local-6989586621680778979"><span class="hs-identifier hs-var">nonnull</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isDigit"><span class="hs-identifier hs-var">isDigit</span></a></span><span>
</span><span id="line-1228"></span><span>
</span><span id="line-1229"></span><span>     </span><span id="local-6989586621680779020"><span class="annot"><span class="annottext">lexDotDigits :: String -&gt; m (String, String)
</span><a href="#local-6989586621680779020"><span class="hs-identifier hs-var hs-var">lexDotDigits</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'.'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680778970"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778970"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String, String) -&gt; m (String, String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
</span><a href="#local-6989586621680778969"><span class="hs-identifier hs-var">span'</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isDigit"><span class="hs-identifier hs-var">isDigit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778970"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1230"></span><span>     </span><span class="annot"><a href="#local-6989586621680779020"><span class="hs-identifier hs-var">lexDotDigits</span></a></span><span> </span><span id="local-6989586621680778968"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778968"><span class="hs-identifier hs-var">s</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String, String) -&gt; m (String, String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778968"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1231"></span><span>
</span><span id="line-1232"></span><span>     </span><span id="local-6989586621680778979"><span class="annot"><span class="annottext">nonnull :: (Char -&gt; Bool) -&gt; String -&gt; m (String, String)
</span><a href="#local-6989586621680778979"><span class="hs-identifier hs-var hs-var">nonnull</span></a></span></span><span> </span><span id="local-6989586621680778961"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621680778961"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621680778960"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778960"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680778959"><span class="annot"><span class="annottext">cs :: String
</span><a href="#local-6989586621680778959"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span id="local-6989586621680778958"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778958"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(String, String) -&gt; m (String, String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
</span><a href="#local-6989586621680778969"><span class="hs-identifier hs-var">span'</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621680778961"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778960"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1233"></span><span>                      </span><span class="annot"><span class="annottext">(String, String) -&gt; m (String, String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778959"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778958"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1234"></span><span>
</span><span id="line-1235"></span><span>     </span><span id="local-6989586621680778969"><span class="annot"><span class="annottext">span' :: (Char -&gt; Bool) -&gt; String -&gt; (String, String)
</span><a href="#local-6989586621680778969"><span class="hs-identifier hs-var hs-var">span'</span></a></span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680778956"><span class="annot"><span class="annottext">xs :: String
</span><a href="#local-6989586621680778956"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">[</span><span class="hs-special">]</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778956"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778956"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1236"></span><span>     </span><span class="annot"><a href="#local-6989586621680778969"><span class="hs-identifier hs-var">span'</span></a></span><span> </span><span id="local-6989586621680778955"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621680778955"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621680778954"><span class="annot"><span class="annottext">xs :: String
</span><a href="#local-6989586621680778954"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621680778953"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778953"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680778952"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778952"><span class="hs-identifier hs-var">xs'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1237"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778953"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'_'</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
</span><a href="#local-6989586621680778969"><span class="hs-identifier hs-var">span'</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621680778955"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778952"><span class="hs-identifier hs-var">xs'</span></a></span><span>   </span><span class="hs-comment">-- skip &quot;_&quot; (#14473)</span><span>
</span><span id="line-1238"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621680778955"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778953"><span class="hs-identifier hs-var">x</span></a></span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680778951"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778951"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680778950"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778950"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
</span><a href="#local-6989586621680778969"><span class="hs-identifier hs-var">span'</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621680778955"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778952"><span class="hs-identifier hs-var">xs'</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778953"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778951"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778950"><span class="hs-identifier hs-var">zs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1239"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778954"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1240"></span><span>
</span><span id="line-1241"></span><span class="annot"><a href="GHC.Utils.Misc.html#readRational"><span class="hs-identifier hs-type">readRational</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Real.html#Rational"><span class="hs-identifier hs-type">Rational</span></a></span><span> </span><span class="hs-comment">-- NB: *does* handle a leading &quot;-&quot;</span><span>
</span><span id="line-1242"></span><span id="readRational"><span class="annot"><span class="annottext">readRational :: String -&gt; Rational
</span><a href="GHC.Utils.Misc.html#readRational"><span class="hs-identifier hs-var hs-var">readRational</span></a></span></span><span> </span><span id="local-6989586621680778949"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778949"><span class="hs-identifier hs-var">top_s</span></a></span></span><span>
</span><span id="line-1243"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778949"><span class="hs-identifier hs-var">top_s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1244"></span><span>      </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680778948"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778948"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Rational
</span><a href="#local-6989586621680778947"><span class="hs-identifier hs-var">read_me</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778948"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1245"></span><span>      </span><span id="local-6989586621680778946"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778946"><span class="hs-identifier hs-var">xs</span></a></span></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Rational
</span><a href="#local-6989586621680778947"><span class="hs-identifier hs-var">read_me</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778946"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1246"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1247"></span><span>    </span><span id="local-6989586621680778947"><span class="annot"><span class="annottext">read_me :: String -&gt; Rational
</span><a href="#local-6989586621680778947"><span class="hs-identifier hs-var hs-var">read_me</span></a></span></span><span> </span><span id="local-6989586621680778938"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778938"><span class="hs-identifier hs-var">s</span></a></span></span><span>
</span><span id="line-1248"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680778937"><span class="annot"><span class="annottext">Rational
</span><a href="#local-6989586621680778937"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ReadS Rational
</span><a href="GHC.Utils.Misc.html#readRational__"><span class="hs-identifier hs-var">readRational__</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778938"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Rational -&gt; [Rational]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Rational
</span><a href="#local-6989586621680778937"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1249"></span><span>          </span><span class="hs-special">[</span><span id="local-6989586621680778936"><span class="annot"><span class="annottext">Rational
</span><a href="#local-6989586621680778936"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Rational
</span><a href="#local-6989586621680778936"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1250"></span><span>          </span><span class="hs-special">[</span><span class="hs-special">]</span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Rational
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;readRational: no parse:&quot;</span></span><span>        </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778949"><span class="hs-identifier hs-var">top_s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1251"></span><span>          </span><span class="annot"><span class="annottext">[Rational]
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Rational
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;readRational: ambiguous parse:&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778949"><span class="hs-identifier hs-var">top_s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1252"></span><span>
</span><span id="line-1253"></span><span>
</span><span id="line-1254"></span><span class="annot"><a href="GHC.Utils.Misc.html#readHexRational"><span class="hs-identifier hs-type">readHexRational</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Real.html#Rational"><span class="hs-identifier hs-type">Rational</span></a></span><span>
</span><span id="line-1255"></span><span id="readHexRational"><span class="annot"><span class="annottext">readHexRational :: String -&gt; Rational
</span><a href="GHC.Utils.Misc.html#readHexRational"><span class="hs-identifier hs-var hs-var">readHexRational</span></a></span></span><span> </span><span id="local-6989586621680778935"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778935"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1256"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778935"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1257"></span><span>    </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680778934"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778934"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Rational
</span><a href="#local-6989586621680778933"><span class="hs-identifier hs-var">readMe</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778934"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1258"></span><span>    </span><span id="local-6989586621680778932"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778932"><span class="hs-identifier hs-var">xs</span></a></span></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Rational
</span><a href="#local-6989586621680778933"><span class="hs-identifier hs-var">readMe</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778932"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1259"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1260"></span><span>  </span><span id="local-6989586621680778933"><span class="annot"><span class="annottext">readMe :: String -&gt; Rational
</span><a href="#local-6989586621680778933"><span class="hs-identifier hs-var hs-var">readMe</span></a></span></span><span> </span><span id="local-6989586621680778929"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778929"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1261"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe Rational
</span><a href="GHC.Utils.Misc.html#readHexRational__"><span class="hs-identifier hs-var">readHexRational__</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778929"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1262"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680778927"><span class="annot"><span class="annottext">Rational
</span><a href="#local-6989586621680778927"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Rational
</span><a href="#local-6989586621680778927"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1263"></span><span>      </span><span class="annot"><span class="annottext">Maybe Rational
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Rational
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;readHexRational: no parse:&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778935"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1264"></span><span>
</span><span id="line-1265"></span><span>
</span><span id="line-1266"></span><span class="annot"><a href="GHC.Utils.Misc.html#readHexRational__"><span class="hs-identifier hs-type">readHexRational__</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Real.html#Rational"><span class="hs-identifier hs-type">Rational</span></a></span><span>
</span><span id="line-1267"></span><span id="readHexRational__"><span class="annot"><span class="annottext">readHexRational__ :: String -&gt; Maybe Rational
</span><a href="GHC.Utils.Misc.html#readHexRational__"><span class="hs-identifier hs-var hs-var">readHexRational__</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'0'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680778926"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778926"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680778925"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778925"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1268"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778926"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'X'</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778926"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'x'</span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1269"></span><span>  </span><span class="hs-keyword">do</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680778924"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778924"><span class="hs-identifier hs-var">front</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680778923"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778923"><span class="hs-identifier hs-var">rest2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
</span><a href="#local-6989586621680778922"><span class="hs-identifier hs-var">span'</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isHexDigit"><span class="hs-identifier hs-var">isHexDigit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778925"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-1270"></span><span>     </span><span class="annot"><span class="annottext">Bool -&gt; Maybe ()
forall (f :: * -&gt; *). Alternative f =&gt; Bool -&gt; f ()
</span><a href="../../base/src/Control.Monad.html#guard"><span class="hs-identifier hs-var">guard</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778924"><span class="hs-identifier hs-var">front</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1271"></span><span>     </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680778917"><span class="annot"><span class="annottext">frontNum :: Integer
</span><a href="#local-6989586621680778917"><span class="hs-identifier hs-var hs-var">frontNum</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; String -&gt; Integer
forall {t :: * -&gt; *} {b}.
(Foldable t, Num b) =&gt;
b -&gt; b -&gt; t Char -&gt; b
</span><a href="#local-6989586621680778916"><span class="hs-identifier hs-var">steps</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">16</span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778924"><span class="hs-identifier hs-var">front</span></a></span><span>
</span><span id="line-1272"></span><span>     </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778923"><span class="hs-identifier hs-var">rest2</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1273"></span><span>       </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'.'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680778915"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778915"><span class="hs-identifier hs-var">rest3</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1274"></span><span>          </span><span class="hs-keyword">do</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680778914"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778914"><span class="hs-identifier hs-var">back</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680778913"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778913"><span class="hs-identifier hs-var">rest4</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
</span><a href="#local-6989586621680778922"><span class="hs-identifier hs-var">span'</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isHexDigit"><span class="hs-identifier hs-var">isHexDigit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778915"><span class="hs-identifier hs-var">rest3</span></a></span><span>
</span><span id="line-1275"></span><span>             </span><span class="annot"><span class="annottext">Bool -&gt; Maybe ()
forall (f :: * -&gt; *). Alternative f =&gt; Bool -&gt; f ()
</span><a href="../../base/src/Control.Monad.html#guard"><span class="hs-identifier hs-var">guard</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778914"><span class="hs-identifier hs-var">back</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1276"></span><span>             </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680778909"><span class="annot"><span class="annottext">backNum :: Integer
</span><a href="#local-6989586621680778909"><span class="hs-identifier hs-var hs-var">backNum</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; String -&gt; Integer
forall {t :: * -&gt; *} {b}.
(Foldable t, Num b) =&gt;
b -&gt; b -&gt; t Char -&gt; b
</span><a href="#local-6989586621680778916"><span class="hs-identifier hs-var">steps</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">16</span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680778917"><span class="hs-identifier hs-var">frontNum</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778914"><span class="hs-identifier hs-var">back</span></a></span><span>
</span><span id="line-1277"></span><span>                 </span><span id="local-6989586621680778904"><span class="annot"><span class="annottext">exp1 :: Int
</span><a href="#local-6989586621680778904"><span class="hs-identifier hs-var hs-var">exp1</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778914"><span class="hs-identifier hs-var">back</span></a></span><span>
</span><span id="line-1278"></span><span>             </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778913"><span class="hs-identifier hs-var">rest4</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1279"></span><span>               </span><span id="local-6989586621680778903"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778903"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680778902"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778902"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621680778901"><span class="hs-identifier hs-var">isExp</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778903"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Rational) -&gt; Maybe Int -&gt; Maybe Rational
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; Rational
</span><a href="#local-6989586621680778900"><span class="hs-identifier hs-var">mk</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680778909"><span class="hs-identifier hs-var">backNum</span></a></span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Rational) -&gt; (Int -&gt; Int) -&gt; Int -&gt; Rational
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680778904"><span class="hs-identifier hs-var">exp1</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Maybe Int
forall {a}. Num a =&gt; String -&gt; Maybe a
</span><a href="#local-6989586621680778899"><span class="hs-identifier hs-var">getExp</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778902"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1280"></span><span>               </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Rational -&gt; Maybe Rational
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; Rational
</span><a href="#local-6989586621680778900"><span class="hs-identifier hs-var">mk</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680778909"><span class="hs-identifier hs-var">backNum</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680778904"><span class="hs-identifier hs-var">exp1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1281"></span><span>       </span><span id="local-6989586621680778898"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778898"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680778897"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778897"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621680778901"><span class="hs-identifier hs-var">isExp</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778898"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Rational) -&gt; Maybe Int -&gt; Maybe Rational
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; Rational
</span><a href="#local-6989586621680778900"><span class="hs-identifier hs-var">mk</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680778917"><span class="hs-identifier hs-var">frontNum</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Maybe Int
forall {a}. Num a =&gt; String -&gt; Maybe a
</span><a href="#local-6989586621680778899"><span class="hs-identifier hs-var">getExp</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778897"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1282"></span><span>       </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe Rational
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1283"></span><span>
</span><span id="line-1284"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1285"></span><span>  </span><span id="local-6989586621680778901"><span class="annot"><span class="annottext">isExp :: Char -&gt; Bool
</span><a href="#local-6989586621680778901"><span class="hs-identifier hs-var hs-var">isExp</span></a></span></span><span> </span><span id="local-6989586621680778894"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778894"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778894"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'p'</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778894"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'P'</span></span><span>
</span><span id="line-1286"></span><span>
</span><span id="line-1287"></span><span>  </span><span id="local-6989586621680778899"><span class="annot"><span class="annottext">getExp :: String -&gt; Maybe a
</span><a href="#local-6989586621680778899"><span class="hs-identifier hs-var hs-var">getExp</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'+'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680778887"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778887"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe a
forall {a}. Num a =&gt; String -&gt; Maybe a
</span><a href="#local-6989586621680778886"><span class="hs-identifier hs-var">dec</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778887"><span class="hs-identifier hs-var">ds</span></a></span><span>
</span><span id="line-1288"></span><span>  </span><span class="annot"><a href="#local-6989586621680778899"><span class="hs-identifier hs-var">getExp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680778885"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778885"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a) -&gt; Maybe a -&gt; Maybe a
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Maybe a
forall {a}. Num a =&gt; String -&gt; Maybe a
</span><a href="#local-6989586621680778886"><span class="hs-identifier hs-var">dec</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778885"><span class="hs-identifier hs-var">ds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1289"></span><span>  </span><span class="annot"><a href="#local-6989586621680778899"><span class="hs-identifier hs-var">getExp</span></a></span><span> </span><span id="local-6989586621680778884"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778884"><span class="hs-identifier hs-var">ds</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe a
forall {a}. Num a =&gt; String -&gt; Maybe a
</span><a href="#local-6989586621680778886"><span class="hs-identifier hs-var">dec</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778884"><span class="hs-identifier hs-var">ds</span></a></span><span>
</span><span id="line-1290"></span><span>
</span><span id="line-1291"></span><span>  </span><span class="annot"><a href="#local-6989586621680778900"><span class="hs-identifier hs-type">mk</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Real.html#Rational"><span class="hs-identifier hs-type">Rational</span></a></span><span>
</span><span id="line-1292"></span><span>  </span><span id="local-6989586621680778900"><span class="annot"><span class="annottext">mk :: Integer -&gt; Int -&gt; Rational
</span><a href="#local-6989586621680778900"><span class="hs-identifier hs-var hs-var">mk</span></a></span></span><span> </span><span id="local-6989586621680778883"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680778883"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680778882"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680778882"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Rational
forall a. Num a =&gt; Integer -&gt; a
</span><a href="../../base/src/GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680778883"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Rational -&gt; Rational -&gt; Rational
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Rational
</span><span class="hs-number">2</span></span><span class="annot"><span class="annottext">Rational -&gt; Int -&gt; Rational
forall a b. (Fractional a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Real.html#%5E%5E"><span class="hs-operator hs-var">^^</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680778882"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-1293"></span><span>
</span><span id="line-1294"></span><span>  </span><span id="local-6989586621680778886"><span class="annot"><span class="annottext">dec :: String -&gt; Maybe a
</span><a href="#local-6989586621680778886"><span class="hs-identifier hs-var hs-var">dec</span></a></span></span><span> </span><span id="local-6989586621680778875"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778875"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
</span><a href="#local-6989586621680778922"><span class="hs-identifier hs-var">span'</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isDigit"><span class="hs-identifier hs-var">isDigit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778875"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1295"></span><span>             </span><span class="hs-special">(</span><span id="local-6989586621680778874"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778874"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778874"><span class="hs-identifier hs-var">ds</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a -&gt; String -&gt; a
forall {t :: * -&gt; *} {b}.
(Foldable t, Num b) =&gt;
b -&gt; b -&gt; t Char -&gt; b
</span><a href="#local-6989586621680778916"><span class="hs-identifier hs-var">steps</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">10</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778874"><span class="hs-identifier hs-var">ds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1296"></span><span>             </span><span class="annot"><span class="annottext">(String, String)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1297"></span><span>
</span><span id="line-1298"></span><span>  </span><span id="local-6989586621680778916"><span class="annot"><span class="annottext">steps :: b -&gt; b -&gt; t Char -&gt; b
</span><a href="#local-6989586621680778916"><span class="hs-identifier hs-var hs-var">steps</span></a></span></span><span> </span><span id="local-6989586621680778869"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680778869"><span class="hs-identifier hs-var">base</span></a></span></span><span> </span><span id="local-6989586621680778868"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680778868"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680778867"><span class="annot"><span class="annottext">t Char
</span><a href="#local-6989586621680778867"><span class="hs-identifier hs-var">ds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(b -&gt; Char -&gt; b) -&gt; b -&gt; t Char -&gt; b
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; b -&gt; Char -&gt; b
forall {a}. Num a =&gt; a -&gt; a -&gt; Char -&gt; a
</span><a href="#local-6989586621680778866"><span class="hs-identifier hs-var">step</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680778869"><span class="hs-identifier hs-var">base</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680778868"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">t Char
</span><a href="#local-6989586621680778867"><span class="hs-identifier hs-var">ds</span></a></span><span>
</span><span id="line-1299"></span><span>  </span><span id="local-6989586621680778866"><span class="annot"><span class="annottext">step :: a -&gt; a -&gt; Char -&gt; a
</span><a href="#local-6989586621680778866"><span class="hs-identifier hs-var hs-var">step</span></a></span></span><span>  </span><span id="local-6989586621680778860"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680778860"><span class="hs-identifier hs-var">base</span></a></span></span><span> </span><span id="local-6989586621680778859"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680778859"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680778858"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778858"><span class="hs-identifier hs-var">d</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680778860"><span class="hs-identifier hs-var">base</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680778859"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="../../base/src/Data.Char.html#digitToInt"><span class="hs-identifier hs-var">digitToInt</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778858"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1300"></span><span>
</span><span id="line-1301"></span><span>  </span><span id="local-6989586621680778922"><span class="annot"><span class="annottext">span' :: (Char -&gt; Bool) -&gt; String -&gt; (String, String)
</span><a href="#local-6989586621680778922"><span class="hs-identifier hs-var hs-var">span'</span></a></span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680778856"><span class="annot"><span class="annottext">xs :: String
</span><a href="#local-6989586621680778856"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">[</span><span class="hs-special">]</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778856"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778856"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1302"></span><span>  </span><span class="annot"><a href="#local-6989586621680778922"><span class="hs-identifier hs-var">span'</span></a></span><span> </span><span id="local-6989586621680778855"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621680778855"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621680778854"><span class="annot"><span class="annottext">xs :: String
</span><a href="#local-6989586621680778854"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621680778853"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778853"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680778852"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778852"><span class="hs-identifier hs-var">xs'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1303"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778853"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'_'</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
</span><a href="#local-6989586621680778922"><span class="hs-identifier hs-var">span'</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621680778855"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778852"><span class="hs-identifier hs-var">xs'</span></a></span><span>   </span><span class="hs-comment">-- skip &quot;_&quot;  (#14473)</span><span>
</span><span id="line-1304"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621680778855"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778853"><span class="hs-identifier hs-var">x</span></a></span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680778851"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778851"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680778850"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778850"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
</span><a href="#local-6989586621680778922"><span class="hs-identifier hs-var">span'</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621680778855"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778852"><span class="hs-identifier hs-var">xs'</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778853"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778851"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778850"><span class="hs-identifier hs-var">zs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1305"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778854"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1306"></span><span>
</span><span id="line-1307"></span><span class="annot"><a href="GHC.Utils.Misc.html#readHexRational__"><span class="hs-identifier hs-var">readHexRational__</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Rational
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1308"></span><span>
</span><span id="line-1309"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-1310"></span><span class="hs-comment">-- Verify that the 'dirname' portion of a FilePath exists.</span><span>
</span><span id="line-1311"></span><span class="hs-comment">--</span><span>
</span><span id="line-1312"></span><span class="annot"><a href="GHC.Utils.Misc.html#doesDirNameExist"><span class="hs-identifier hs-type">doesDirNameExist</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1313"></span><span id="doesDirNameExist"><span class="annot"><span class="annottext">doesDirNameExist :: String -&gt; IO Bool
</span><a href="GHC.Utils.Misc.html#doesDirNameExist"><span class="hs-identifier hs-var hs-var">doesDirNameExist</span></a></span></span><span> </span><span id="local-6989586621680778848"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778848"><span class="hs-identifier hs-var">fpath</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO Bool
</span><a href="../../directory/src/System.Directory.html#doesDirectoryExist"><span class="hs-identifier hs-var">doesDirectoryExist</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#takeDirectory"><span class="hs-identifier hs-var">takeDirectory</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778848"><span class="hs-identifier hs-var">fpath</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1314"></span><span>
</span><span id="line-1315"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-1316"></span><span class="hs-comment">-- Backwards compatibility definition of getModificationTime</span><span>
</span><span id="line-1317"></span><span>
</span><span id="line-1318"></span><span class="annot"><a href="GHC.Utils.Misc.html#getModificationUTCTime"><span class="hs-identifier hs-type">getModificationUTCTime</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../time/src/Data.Time.Clock.Internal.UTCTime.html#UTCTime"><span class="hs-identifier hs-type">UTCTime</span></a></span><span>
</span><span id="line-1319"></span><span id="getModificationUTCTime"><span class="annot"><span class="annottext">getModificationUTCTime :: String -&gt; IO UTCTime
</span><a href="GHC.Utils.Misc.html#getModificationUTCTime"><span class="hs-identifier hs-var hs-var">getModificationUTCTime</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO UTCTime
</span><a href="../../directory/src/System.Directory.html#getModificationTime"><span class="hs-identifier hs-var">getModificationTime</span></a></span><span>
</span><span id="line-1320"></span><span>
</span><span id="line-1321"></span><span class="hs-comment">-- --------------------------------------------------------------</span><span>
</span><span id="line-1322"></span><span class="hs-comment">-- check existence &amp; modification time at the same time</span><span>
</span><span id="line-1323"></span><span>
</span><span id="line-1324"></span><span class="annot"><a href="GHC.Utils.Misc.html#modificationTimeIfExists"><span class="hs-identifier hs-type">modificationTimeIfExists</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../time/src/Data.Time.Clock.Internal.UTCTime.html#UTCTime"><span class="hs-identifier hs-type">UTCTime</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1325"></span><span id="modificationTimeIfExists"><span class="annot"><span class="annottext">modificationTimeIfExists :: String -&gt; IO (Maybe UTCTime)
</span><a href="GHC.Utils.Misc.html#modificationTimeIfExists"><span class="hs-identifier hs-var hs-var">modificationTimeIfExists</span></a></span></span><span> </span><span id="local-6989586621680778846"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778846"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1326"></span><span>  </span><span class="hs-special">(</span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680778845"><span class="annot"><span class="annottext">UTCTime
</span><a href="#local-6989586621680778845"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO UTCTime
</span><a href="GHC.Utils.Misc.html#getModificationUTCTime"><span class="hs-identifier hs-var">getModificationUTCTime</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778846"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Maybe UTCTime -&gt; IO (Maybe UTCTime)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UTCTime -&gt; Maybe UTCTime
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">UTCTime
</span><a href="#local-6989586621680778845"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1327"></span><span>        </span><span class="annot"><span class="annottext">IO (Maybe UTCTime)
-&gt; (IOException -&gt; IO (Maybe UTCTime)) -&gt; IO (Maybe UTCTime)
forall a. IO a -&gt; (IOException -&gt; IO a) -&gt; IO a
</span><a href="GHC.Utils.Exception.html#catchIO"><span class="hs-operator hs-var">`catchIO`</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621680778843"><span class="annot"><span class="annottext">IOException
</span><a href="#local-6989586621680778843"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">IOException -&gt; Bool
</span><a href="../../base/src/System.IO.Error.html#isDoesNotExistError"><span class="hs-identifier hs-var">isDoesNotExistError</span></a></span><span> </span><span class="annot"><span class="annottext">IOException
</span><a href="#local-6989586621680778843"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-1328"></span><span>                        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Maybe UTCTime -&gt; IO (Maybe UTCTime)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe UTCTime
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1329"></span><span>                        </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">IOException -&gt; IO (Maybe UTCTime)
forall a. IOException -&gt; IO a
</span><a href="../../base/src/GHC.IO.Exception.html#ioError"><span class="hs-identifier hs-var">ioError</span></a></span><span> </span><span class="annot"><span class="annottext">IOException
</span><a href="#local-6989586621680778843"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-1330"></span><span>
</span><span id="line-1331"></span><span class="hs-comment">-- --------------------------------------------------------------</span><span>
</span><span id="line-1332"></span><span class="hs-comment">-- atomic file writing by writing to a temporary file first (see #14533)</span><span>
</span><span id="line-1333"></span><span class="hs-comment">--</span><span>
</span><span id="line-1334"></span><span class="hs-comment">-- This should be used in all cases where GHC writes files to disk</span><span>
</span><span id="line-1335"></span><span class="hs-comment">-- and uses their modification time to skip work later,</span><span>
</span><span id="line-1336"></span><span class="hs-comment">-- as otherwise a partially written file (e.g. due to crash or Ctrl+C)</span><span>
</span><span id="line-1337"></span><span class="hs-comment">-- also results in a skip.</span><span>
</span><span id="line-1338"></span><span>
</span><span id="line-1339"></span><span id="local-6989586621680780103"><span id="local-6989586621680780105"><span class="annot"><a href="GHC.Utils.Misc.html#withAtomicRename"><span class="hs-identifier hs-type">withAtomicRename</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#MonadIO"><span class="hs-identifier hs-type">MonadIO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780105"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780105"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780103"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680780105"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680780103"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1340"></span><span id="withAtomicRename"><span class="annot"><span class="annottext">withAtomicRename :: forall (m :: * -&gt; *) a.
MonadIO m =&gt;
String -&gt; (String -&gt; m a) -&gt; m a
</span><a href="GHC.Utils.Misc.html#withAtomicRename"><span class="hs-identifier hs-var hs-var">withAtomicRename</span></a></span></span><span> </span><span id="local-6989586621680778834"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778834"><span class="hs-identifier hs-var">targetFile</span></a></span></span><span> </span><span id="local-6989586621680778833"><span class="annot"><span class="annottext">String -&gt; m a
</span><a href="#local-6989586621680778833"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1341"></span><span>  </span><span class="hs-comment">-- The temp file must be on the same file system (mount) as the target file</span><span>
</span><span id="line-1342"></span><span>  </span><span class="hs-comment">-- to result in an atomic move on most platforms.</span><span>
</span><span id="line-1343"></span><span>  </span><span class="hs-comment">-- The standard way to ensure that is to place it into the same directory.</span><span>
</span><span id="line-1344"></span><span>  </span><span class="hs-comment">-- This can still be fooled when somebody mounts a different file system</span><span>
</span><span id="line-1345"></span><span>  </span><span class="hs-comment">-- at just the right time, but that is not a case we aim to cover here.</span><span>
</span><span id="line-1346"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680778832"><span class="annot"><span class="annottext">temp :: String
</span><a href="#local-6989586621680778832"><span class="hs-identifier hs-var hs-var">temp</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778834"><span class="hs-identifier hs-var">targetFile</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tmp&quot;</span></span><span>
</span><span id="line-1347"></span><span>  </span><span id="local-6989586621680778830"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680778830"><span class="hs-identifier hs-var">res</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; m a
</span><a href="#local-6989586621680778833"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778832"><span class="hs-identifier hs-var">temp</span></a></span><span>
</span><span id="line-1348"></span><span>  </span><span class="annot"><span class="annottext">IO () -&gt; m ()
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; m ()) -&gt; IO () -&gt; m ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; IO ()
</span><a href="../../directory/src/System.Directory.html#renameFile"><span class="hs-identifier hs-var">renameFile</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778832"><span class="hs-identifier hs-var">temp</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778834"><span class="hs-identifier hs-var">targetFile</span></a></span><span>
</span><span id="line-1349"></span><span>  </span><span class="annot"><span class="annottext">a -&gt; m a
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680778830"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1350"></span><span>
</span><span id="line-1351"></span><span class="hs-comment">-- --------------------------------------------------------------</span><span>
</span><span id="line-1352"></span><span class="hs-comment">-- split a string at the last character where 'pred' is True,</span><span>
</span><span id="line-1353"></span><span class="hs-comment">-- returning a pair of strings. The first component holds the string</span><span>
</span><span id="line-1354"></span><span class="hs-comment">-- up (but not including) the last character for which 'pred' returned</span><span>
</span><span id="line-1355"></span><span class="hs-comment">-- True, the second whatever comes after (but also not including the</span><span>
</span><span id="line-1356"></span><span class="hs-comment">-- last character).</span><span>
</span><span id="line-1357"></span><span class="hs-comment">--</span><span>
</span><span id="line-1358"></span><span class="hs-comment">-- If 'pred' returns False for all characters in the string, the original</span><span>
</span><span id="line-1359"></span><span class="hs-comment">-- string is returned in the first component (and the second one is just</span><span>
</span><span id="line-1360"></span><span class="hs-comment">-- empty).</span><span>
</span><span id="line-1361"></span><span class="annot"><a href="GHC.Utils.Misc.html#splitLongestPrefix"><span class="hs-identifier hs-type">splitLongestPrefix</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1362"></span><span id="splitLongestPrefix"><span class="annot"><span class="annottext">splitLongestPrefix :: String -&gt; (Char -&gt; Bool) -&gt; (String, String)
</span><a href="GHC.Utils.Misc.html#splitLongestPrefix"><span class="hs-identifier hs-var hs-var">splitLongestPrefix</span></a></span></span><span> </span><span id="local-6989586621680778829"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778829"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span id="local-6989586621680778828"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621680778828"><span class="hs-identifier hs-var">pred</span></a></span></span><span>
</span><span id="line-1363"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">String -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778827"><span class="hs-identifier hs-var">r_pre</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778829"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">,</span><span>           </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1364"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#tail"><span class="hs-identifier hs-var">tail</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778827"><span class="hs-identifier hs-var">r_pre</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; String
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778825"><span class="hs-identifier hs-var">r_suf</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1365"></span><span>                           </span><span class="hs-comment">-- 'tail' drops the char satisfying 'pred'</span><span>
</span><span id="line-1366"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680778825"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778825"><span class="hs-identifier hs-var">r_suf</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680778827"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778827"><span class="hs-identifier hs-var">r_pre</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#break"><span class="hs-identifier hs-var">break</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621680778828"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778829"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1367"></span><span>
</span><span id="line-1368"></span><span class="annot"><a href="GHC.Utils.Misc.html#escapeSpaces"><span class="hs-identifier hs-type">escapeSpaces</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-1369"></span><span id="escapeSpaces"><span class="annot"><span class="annottext">escapeSpaces :: String -&gt; String
</span><a href="GHC.Utils.Misc.html#escapeSpaces"><span class="hs-identifier hs-var hs-var">escapeSpaces</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; String -&gt; String) -&gt; String -&gt; String -&gt; String
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680778824"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778824"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680778823"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778823"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778824"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778824"><span class="hs-identifier hs-var">c</span></a></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778823"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778824"><span class="hs-identifier hs-var">c</span></a></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778823"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-1370"></span><span>
</span><span id="line-1371"></span><span class="hs-keyword">type</span><span> </span><span id="Suffix"><span class="annot"><a href="GHC.Utils.Misc.html#Suffix"><span class="hs-identifier hs-var">Suffix</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-1372"></span><span>
</span><span id="line-1373"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-1374"></span><span class="hs-comment">-- * Search path</span><span>
</span><span id="line-1375"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-1376"></span><span>
</span><span id="line-1377"></span><span class="hs-keyword">data</span><span> </span><span id="Direction"><span class="annot"><a href="GHC.Utils.Misc.html#Direction"><span class="hs-identifier hs-var">Direction</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Forwards"><span class="annot"><a href="GHC.Utils.Misc.html#Forwards"><span class="hs-identifier hs-var">Forwards</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="Backwards"><span class="annot"><a href="GHC.Utils.Misc.html#Backwards"><span class="hs-identifier hs-var">Backwards</span></a></span></span><span>
</span><span id="line-1378"></span><span>
</span><span id="line-1379"></span><span class="annot"><a href="GHC.Utils.Misc.html#reslash"><span class="hs-identifier hs-type">reslash</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#Direction"><span class="hs-identifier hs-type">Direction</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>
</span><span id="line-1380"></span><span id="reslash"><span class="annot"><span class="annottext">reslash :: Direction -&gt; String -&gt; String
</span><a href="GHC.Utils.Misc.html#reslash"><span class="hs-identifier hs-var hs-var">reslash</span></a></span></span><span> </span><span id="local-6989586621680778820"><span class="annot"><span class="annottext">Direction
</span><a href="#local-6989586621680778820"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621680778819"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-1381"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680778819"><span class="annot"><span class="annottext">f :: String -&gt; String
</span><a href="#local-6989586621680778819"><span class="hs-identifier hs-var hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'/'</span></span><span>  </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680778818"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778818"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778817"><span class="hs-identifier hs-var">slash</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621680778819"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778818"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1382"></span><span>          </span><span class="annot"><a href="#local-6989586621680778819"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680778816"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778816"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778817"><span class="hs-identifier hs-var">slash</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621680778819"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778816"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1383"></span><span>          </span><span class="annot"><a href="#local-6989586621680778819"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680778815"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778815"><span class="hs-identifier hs-var">x</span></a></span></span><span>    </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680778814"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778814"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778815"><span class="hs-identifier hs-var">x</span></a></span><span>     </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621680778819"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778814"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1384"></span><span>          </span><span class="annot"><a href="#local-6989586621680778819"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-1385"></span><span>          </span><span id="local-6989586621680778817"><span class="annot"><span class="annottext">slash :: Char
</span><a href="#local-6989586621680778817"><span class="hs-identifier hs-var hs-var">slash</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Direction
</span><a href="#local-6989586621680778820"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1386"></span><span>                  </span><span class="annot"><span class="annottext">Direction
</span><a href="GHC.Utils.Misc.html#Forwards"><span class="hs-identifier hs-var">Forwards</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'/'</span></span><span>
</span><span id="line-1387"></span><span>                  </span><span class="annot"><span class="annottext">Direction
</span><a href="GHC.Utils.Misc.html#Backwards"><span class="hs-identifier hs-var">Backwards</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span>
</span><span id="line-1388"></span><span>
</span><span id="line-1389"></span><span class="annot"><a href="GHC.Utils.Misc.html#makeRelativeTo"><span class="hs-identifier hs-type">makeRelativeTo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>
</span><span id="line-1390"></span><span id="local-6989586621680778813"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778813"><span class="hs-identifier hs-var">this</span></a></span></span><span> </span><span id="makeRelativeTo"><span class="annot"><span class="annottext">makeRelativeTo :: String -&gt; String -&gt; String
</span><a href="GHC.Utils.Misc.html#makeRelativeTo"><span class="hs-operator hs-var hs-var">`makeRelativeTo`</span></a></span></span><span> </span><span id="local-6989586621680778812"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778812"><span class="hs-identifier hs-var">that</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778811"><span class="hs-identifier hs-var">directory</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C%2F%3E"><span class="hs-operator hs-var">&lt;/&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778809"><span class="hs-identifier hs-var">thisFilename</span></a></span><span>
</span><span id="line-1391"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680778808"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778808"><span class="hs-identifier hs-var">thisDirectory</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680778809"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778809"><span class="hs-identifier hs-var">thisFilename</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; (String, String)
</span><a href="../../filepath/src/System.FilePath.Windows.html#splitFileName"><span class="hs-identifier hs-var">splitFileName</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778813"><span class="hs-identifier hs-var">this</span></a></span><span>
</span><span id="line-1392"></span><span>          </span><span id="local-6989586621680778806"><span class="annot"><span class="annottext">thatDirectory :: String
</span><a href="#local-6989586621680778806"><span class="hs-identifier hs-var hs-var">thatDirectory</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#dropFileName"><span class="hs-identifier hs-var">dropFileName</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778812"><span class="hs-identifier hs-var">that</span></a></span><span>
</span><span id="line-1393"></span><span>          </span><span id="local-6989586621680778811"><span class="annot"><span class="annottext">directory :: String
</span><a href="#local-6989586621680778811"><span class="hs-identifier hs-var hs-var">directory</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#joinPath"><span class="hs-identifier hs-var">joinPath</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; String) -&gt; [String] -&gt; String
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
</span><a href="#local-6989586621680778803"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; [String]
</span><a href="../../filepath/src/System.FilePath.Windows.html#splitPath"><span class="hs-identifier hs-var">splitPath</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778808"><span class="hs-identifier hs-var">thisDirectory</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1394"></span><span>                                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; [String]
</span><a href="../../filepath/src/System.FilePath.Windows.html#splitPath"><span class="hs-identifier hs-var">splitPath</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778806"><span class="hs-identifier hs-var">thatDirectory</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1395"></span><span>
</span><span id="line-1396"></span><span>          </span><span id="local-6989586621680778803"><span class="annot"><span class="annottext">f :: [String] -&gt; [String] -&gt; [String]
</span><a href="#local-6989586621680778803"><span class="hs-identifier hs-var hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680778797"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778797"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680778796"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680778796"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680778795"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778795"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680778794"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680778794"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1397"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778797"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778795"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
</span><a href="#local-6989586621680778803"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680778796"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680778794"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1398"></span><span>          </span><span class="annot"><a href="#local-6989586621680778803"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span id="local-6989586621680778793"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680778793"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span id="local-6989586621680778792"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680778792"><span class="hs-identifier hs-var">ys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; String -&gt; [String]
forall a. Int -&gt; a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#replicate"><span class="hs-identifier hs-var">replicate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[String] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680778792"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;..&quot;</span></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680778793"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1399"></span><span>
</span><span id="line-1400"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection[Utils-Data]{Utils for defining Data instances}
*                                                                      *
************************************************************************

These functions helps us to define Data instances for abstract types.
-}</span><span>
</span><span id="line-1409"></span><span>
</span><span id="line-1410"></span><span class="annot"><a href="GHC.Utils.Misc.html#abstractConstr"><span class="hs-identifier hs-type">abstractConstr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#Constr"><span class="hs-identifier hs-type">Constr</span></a></span><span>
</span><span id="line-1411"></span><span id="abstractConstr"><span class="annot"><span class="annottext">abstractConstr :: String -&gt; Constr
</span><a href="GHC.Utils.Misc.html#abstractConstr"><span class="hs-identifier hs-var hs-var">abstractConstr</span></a></span></span><span> </span><span id="local-6989586621680778790"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778790"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType -&gt; String -&gt; [String] -&gt; Fixity -&gt; Constr
</span><a href="../../base/src/Data.Data.html#mkConstr"><span class="hs-identifier hs-var">mkConstr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; DataType
</span><a href="GHC.Utils.Misc.html#abstractDataType"><span class="hs-identifier hs-var">abstractDataType</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778790"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;{abstract:&quot;</span></span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778790"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;}&quot;</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="../../base/src/Data.Data.html#Prefix"><span class="hs-identifier hs-var">Prefix</span></a></span><span>
</span><span id="line-1412"></span><span>
</span><span id="line-1413"></span><span class="annot"><a href="GHC.Utils.Misc.html#abstractDataType"><span class="hs-identifier hs-type">abstractDataType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#DataType"><span class="hs-identifier hs-type">DataType</span></a></span><span>
</span><span id="line-1414"></span><span id="abstractDataType"><span class="annot"><span class="annottext">abstractDataType :: String -&gt; DataType
</span><a href="GHC.Utils.Misc.html#abstractDataType"><span class="hs-identifier hs-var hs-var">abstractDataType</span></a></span></span><span> </span><span id="local-6989586621680778787"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778787"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [Constr] -&gt; DataType
</span><a href="../../base/src/Data.Data.html#mkDataType"><span class="hs-identifier hs-var">mkDataType</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778787"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String -&gt; Constr
</span><a href="GHC.Utils.Misc.html#abstractConstr"><span class="hs-identifier hs-var">abstractConstr</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680778787"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1415"></span><span>
</span><span id="line-1416"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection[Utils-C]{Utils for printing C code}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-1423"></span><span>
</span><span id="line-1424"></span><span class="annot"><a href="GHC.Utils.Misc.html#charToC"><span class="hs-identifier hs-type">charToC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-1425"></span><span id="charToC"><span class="annot"><span class="annottext">charToC :: Word8 -&gt; String
</span><a href="GHC.Utils.Misc.html#charToC"><span class="hs-identifier hs-var hs-var">charToC</span></a></span></span><span> </span><span id="local-6989586621680778785"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621680778785"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1426"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Char
</span><a href="../../base/src/GHC.Char.html#chr"><span class="hs-identifier hs-var">chr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621680778785"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1427"></span><span>        </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\&quot;'</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\\\&quot;&quot;</span></span><span>
</span><span id="line-1428"></span><span>        </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\''</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\\\'&quot;</span></span><span>
</span><span id="line-1429"></span><span>        </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\\\\&quot;</span></span><span>
</span><span id="line-1430"></span><span>        </span><span id="local-6989586621680778784"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778784"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778784"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;=</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">' '</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778784"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'~'</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778784"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1431"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span class="hs-special">,</span><span>
</span><span id="line-1432"></span><span>                         </span><span class="annot"><span class="annottext">Int -&gt; Char
</span><a href="../../base/src/GHC.Char.html#chr"><span class="hs-identifier hs-var">chr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="../../base/src/GHC.Base.html#ord"><span class="hs-identifier hs-var">ord</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'0'</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="../../base/src/GHC.Base.html#ord"><span class="hs-identifier hs-var">ord</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778784"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-operator hs-var">`div`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">64</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-1433"></span><span>                         </span><span class="annot"><span class="annottext">Int -&gt; Char
</span><a href="../../base/src/GHC.Char.html#chr"><span class="hs-identifier hs-var">chr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="../../base/src/GHC.Base.html#ord"><span class="hs-identifier hs-var">ord</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'0'</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="../../base/src/GHC.Base.html#ord"><span class="hs-identifier hs-var">ord</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778784"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-operator hs-var">`div`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#mod"><span class="hs-operator hs-var">`mod`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-1434"></span><span>                         </span><span class="annot"><span class="annottext">Int -&gt; Char
</span><a href="../../base/src/GHC.Char.html#chr"><span class="hs-identifier hs-var">chr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="../../base/src/GHC.Base.html#ord"><span class="hs-identifier hs-var">ord</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'0'</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="../../base/src/GHC.Base.html#ord"><span class="hs-identifier hs-var">ord</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778784"><span class="hs-identifier hs-var">c</span></a></span><span>         </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#mod"><span class="hs-operator hs-var">`mod`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1435"></span><span>
</span><span id="line-1436"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection[Utils-Hashing]{Utils for hashing}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-1443"></span><span>
</span><span id="line-1444"></span><span class="hs-comment">-- | A sample hash function for Strings.  We keep multiplying by the</span><span>
</span><span id="line-1445"></span><span class="hs-comment">-- golden ratio and adding.  The implementation is:</span><span>
</span><span id="line-1446"></span><span class="hs-comment">--</span><span>
</span><span id="line-1447"></span><span class="hs-comment">-- &gt; hashString = foldl' f golden</span><span>
</span><span id="line-1448"></span><span class="hs-comment">-- &gt;   where f m c = fromIntegral (ord c) * magic + hashInt32 m</span><span>
</span><span id="line-1449"></span><span class="hs-comment">-- &gt;         magic = 0xdeadbeef</span><span>
</span><span id="line-1450"></span><span class="hs-comment">--</span><span>
</span><span id="line-1451"></span><span class="hs-comment">-- Where hashInt32 works just as hashInt shown above.</span><span>
</span><span id="line-1452"></span><span class="hs-comment">--</span><span>
</span><span id="line-1453"></span><span class="hs-comment">-- Knuth argues that repeated multiplication by the golden ratio</span><span>
</span><span id="line-1454"></span><span class="hs-comment">-- will minimize gaps in the hash space, and thus it's a good choice</span><span>
</span><span id="line-1455"></span><span class="hs-comment">-- for combining together multiple keys to form one.</span><span>
</span><span id="line-1456"></span><span class="hs-comment">--</span><span>
</span><span id="line-1457"></span><span class="hs-comment">-- Here we know that individual characters c are often small, and this</span><span>
</span><span id="line-1458"></span><span class="hs-comment">-- produces frequent collisions if we use ord c alone.  A</span><span>
</span><span id="line-1459"></span><span class="hs-comment">-- particular problem are the shorter low ASCII and ISO-8859-1</span><span>
</span><span id="line-1460"></span><span class="hs-comment">-- character strings.  We pre-multiply by a magic twiddle factor to</span><span>
</span><span id="line-1461"></span><span class="hs-comment">-- obtain a good distribution.  In fact, given the following test:</span><span>
</span><span id="line-1462"></span><span class="hs-comment">--</span><span>
</span><span id="line-1463"></span><span class="hs-comment">-- &gt; testp :: Int32 -&gt; Int</span><span>
</span><span id="line-1464"></span><span class="hs-comment">-- &gt; testp k = (n - ) . length . group . sort . map hs . take n $ ls</span><span>
</span><span id="line-1465"></span><span class="hs-comment">-- &gt;   where ls = [] : [c : l | l &lt;- ls, c &lt;- ['\0'..'\xff']]</span><span>
</span><span id="line-1466"></span><span class="hs-comment">-- &gt;         hs = foldl' f golden</span><span>
</span><span id="line-1467"></span><span class="hs-comment">-- &gt;         f m c = fromIntegral (ord c) * k + hashInt32 m</span><span>
</span><span id="line-1468"></span><span class="hs-comment">-- &gt;         n = 100000</span><span>
</span><span id="line-1469"></span><span class="hs-comment">--</span><span>
</span><span id="line-1470"></span><span class="hs-comment">-- We discover that testp magic = 0.</span><span>
</span><span id="line-1471"></span><span class="annot"><a href="GHC.Utils.Misc.html#hashString"><span class="hs-identifier hs-type">hashString</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span>
</span><span id="line-1472"></span><span id="hashString"><span class="annot"><span class="annottext">hashString :: String -&gt; Int32
</span><a href="GHC.Utils.Misc.html#hashString"><span class="hs-identifier hs-var hs-var">hashString</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int32 -&gt; Char -&gt; Int32) -&gt; Int32 -&gt; String -&gt; Int32
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Char -&gt; Int32
</span><a href="#local-6989586621680778781"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Int32
</span><a href="GHC.Utils.Misc.html#golden"><span class="hs-identifier hs-var">golden</span></a></span><span>
</span><span id="line-1473"></span><span>   </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680778781"><span class="annot"><span class="annottext">f :: Int32 -&gt; Char -&gt; Int32
</span><a href="#local-6989586621680778781"><span class="hs-identifier hs-var hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680778775"><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621680778775"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621680778774"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778774"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int32
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="../../base/src/GHC.Base.html#ord"><span class="hs-identifier hs-var">ord</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680778774"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int32 -&gt; Int32
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621680778773"><span class="hs-identifier hs-var">magic</span></a></span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int32 -&gt; Int32
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int32
</span><a href="GHC.Utils.Misc.html#hashInt32"><span class="hs-identifier hs-var">hashInt32</span></a></span><span> </span><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621680778775"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1474"></span><span>         </span><span id="local-6989586621680778773"><span class="annot"><span class="annottext">magic :: Int32
</span><a href="#local-6989586621680778773"><span class="hs-identifier hs-var hs-var">magic</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Int32
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word32
</span><span class="hs-number">0xdeadbeef</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-identifier hs-type">Word32</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1475"></span><span>
</span><span id="line-1476"></span><span class="annot"><a href="GHC.Utils.Misc.html#golden"><span class="hs-identifier hs-type">golden</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span>
</span><span id="line-1477"></span><span id="golden"><span class="annot"><span class="annottext">golden :: Int32
</span><a href="GHC.Utils.Misc.html#golden"><span class="hs-identifier hs-var hs-var">golden</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int32
</span><span class="hs-number">1013904242</span></span><span> </span><span class="hs-comment">-- = round ((sqrt 5 - 1) * 2^32) :: Int32</span><span>
</span><span id="line-1478"></span><span class="hs-comment">-- was -1640531527 = round ((sqrt 5 - 1) * 2^31) :: Int32</span><span>
</span><span id="line-1479"></span><span class="hs-comment">-- but that has bad mulHi properties (even adding 2^32 to get its inverse)</span><span>
</span><span id="line-1480"></span><span class="hs-comment">-- Whereas the above works well and contains no hash duplications for</span><span>
</span><span id="line-1481"></span><span class="hs-comment">-- [-32767..65536]</span><span>
</span><span id="line-1482"></span><span>
</span><span id="line-1483"></span><span class="hs-comment">-- | A sample (and useful) hash function for Int32,</span><span>
</span><span id="line-1484"></span><span class="hs-comment">-- implemented by extracting the uppermost 32 bits of the 64-bit</span><span>
</span><span id="line-1485"></span><span class="hs-comment">-- result of multiplying by a 33-bit constant.  The constant is from</span><span>
</span><span id="line-1486"></span><span class="hs-comment">-- Knuth, derived from the golden ratio:</span><span>
</span><span id="line-1487"></span><span class="hs-comment">--</span><span>
</span><span id="line-1488"></span><span class="hs-comment">-- &gt; golden = round ((sqrt 5 - 1) * 2^32)</span><span>
</span><span id="line-1489"></span><span class="hs-comment">--</span><span>
</span><span id="line-1490"></span><span class="hs-comment">-- We get good key uniqueness on small inputs</span><span>
</span><span id="line-1491"></span><span class="hs-comment">-- (a problem with previous versions):</span><span>
</span><span id="line-1492"></span><span class="hs-comment">--  (length $ group $ sort $ map hashInt32 [-32767..65536]) == 65536 + 32768</span><span>
</span><span id="line-1493"></span><span class="hs-comment">--</span><span>
</span><span id="line-1494"></span><span class="annot"><a href="GHC.Utils.Misc.html#hashInt32"><span class="hs-identifier hs-type">hashInt32</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span>
</span><span id="line-1495"></span><span id="hashInt32"><span class="annot"><span class="annottext">hashInt32 :: Int32 -&gt; Int32
</span><a href="GHC.Utils.Misc.html#hashInt32"><span class="hs-identifier hs-var hs-var">hashInt32</span></a></span></span><span> </span><span id="local-6989586621680778767"><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621680778767"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int32 -&gt; Int32
</span><a href="GHC.Utils.Misc.html#mulHi"><span class="hs-identifier hs-var">mulHi</span></a></span><span> </span><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621680778767"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int32
</span><a href="GHC.Utils.Misc.html#golden"><span class="hs-identifier hs-var">golden</span></a></span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int32 -&gt; Int32
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621680778767"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1496"></span><span>
</span><span id="line-1497"></span><span class="hs-comment">-- hi 32 bits of a x-bit * 32 bit -&gt; 64-bit multiply</span><span>
</span><span id="line-1498"></span><span class="annot"><a href="GHC.Utils.Misc.html#mulHi"><span class="hs-identifier hs-type">mulHi</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span>
</span><span id="line-1499"></span><span id="mulHi"><span class="annot"><span class="annottext">mulHi :: Int32 -&gt; Int32 -&gt; Int32
</span><a href="GHC.Utils.Misc.html#mulHi"><span class="hs-identifier hs-var hs-var">mulHi</span></a></span></span><span> </span><span id="local-6989586621680778765"><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621680778765"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621680778764"><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621680778764"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int32
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621680778763"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int -&gt; Int64
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">32</span></span><span class="hs-special">)</span><span>
</span><span id="line-1500"></span><span>   </span><span class="hs-keyword">where</span><span> </span><span class="annot"><a href="#local-6989586621680778763"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-1501"></span><span>         </span><span id="local-6989586621680778763"><span class="annot"><span class="annottext">r :: Int64
</span><a href="#local-6989586621680778763"><span class="hs-identifier hs-var hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621680778765"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621680778764"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-1502"></span><span>
</span><span id="line-1503"></span><span class="hs-comment">-- | A call stack constraint, but only when 'isDebugOn'.</span><span class="hs-cpp">
#if defined(DEBUG)
</span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">HasDebugCallStack</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">HasCallStack</span><span class="hs-cpp">
#else
</span><span class="hs-keyword">type</span><span> </span><span id="HasDebugCallStack"><span class="annot"><a href="GHC.Utils.Misc.html#HasDebugCallStack"><span class="hs-identifier hs-var">HasDebugCallStack</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Constraint</span></span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1510"></span><span class="hs-keyword">data</span><span> </span><span id="OverridingBool"><span class="annot"><a href="GHC.Utils.Misc.html#OverridingBool"><span class="hs-identifier hs-var">OverridingBool</span></a></span></span><span>
</span><span id="line-1511"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="Auto"><span class="annot"><a href="GHC.Utils.Misc.html#Auto"><span class="hs-identifier hs-var">Auto</span></a></span></span><span>
</span><span id="line-1512"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Always"><span class="annot"><a href="GHC.Utils.Misc.html#Always"><span class="hs-identifier hs-var">Always</span></a></span></span><span>
</span><span id="line-1513"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Never"><span class="annot"><a href="GHC.Utils.Misc.html#Never"><span class="hs-identifier hs-var">Never</span></a></span></span><span>
</span><span id="line-1514"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span id="local-6989586621680778753"><span id="local-6989586621680778755"><span id="local-6989586621680778757"><span class="annot"><span class="annottext">Int -&gt; OverridingBool -&gt; String -&gt; String
[OverridingBool] -&gt; String -&gt; String
OverridingBool -&gt; String
(Int -&gt; OverridingBool -&gt; String -&gt; String)
-&gt; (OverridingBool -&gt; String)
-&gt; ([OverridingBool] -&gt; String -&gt; String)
-&gt; Show OverridingBool
forall a.
(Int -&gt; a -&gt; String -&gt; String)
-&gt; (a -&gt; String) -&gt; ([a] -&gt; String -&gt; String) -&gt; Show a
showList :: [OverridingBool] -&gt; String -&gt; String
$cshowList :: [OverridingBool] -&gt; String -&gt; String
show :: OverridingBool -&gt; String
$cshow :: OverridingBool -&gt; String
showsPrec :: Int -&gt; OverridingBool -&gt; String -&gt; String
$cshowsPrec :: Int -&gt; OverridingBool -&gt; String -&gt; String
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span>
</span><span id="line-1515"></span><span>
</span><span id="line-1516"></span><span class="annot"><a href="GHC.Utils.Misc.html#overrideWith"><span class="hs-identifier hs-type">overrideWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#OverridingBool"><span class="hs-identifier hs-type">OverridingBool</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1517"></span><span id="overrideWith"><span class="annot"><span class="annottext">overrideWith :: Bool -&gt; OverridingBool -&gt; Bool
</span><a href="GHC.Utils.Misc.html#overrideWith"><span class="hs-identifier hs-var hs-var">overrideWith</span></a></span></span><span> </span><span id="local-6989586621680778751"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680778751"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="annot"><span class="annottext">OverridingBool
</span><a href="GHC.Utils.Misc.html#Auto"><span class="hs-identifier hs-var">Auto</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680778751"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-1518"></span><span class="annot"><a href="GHC.Utils.Misc.html#overrideWith"><span class="hs-identifier hs-var">overrideWith</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">OverridingBool
</span><a href="GHC.Utils.Misc.html#Always"><span class="hs-identifier hs-var">Always</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1519"></span><span class="annot"><a href="GHC.Utils.Misc.html#overrideWith"><span class="hs-identifier hs-var">overrideWith</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">OverridingBool
</span><a href="GHC.Utils.Misc.html#Never"><span class="hs-identifier hs-var">Never</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1520"></span></pre></body></html>